A Bash script is a plain text file which contains a series of…

Question Answered step-by-step A Bash script is a plain text file which contains a series of… A Bash script is a plain text file which contains a series of commands. These commands are a mixture of commands we would normally type ouselves on the command line (such as ls or cp for example) and commands we could type on the command line but generally wouldn’t (you’ll discover these over the next few pages). An important point to remember though is:Anything you can run normally on the command line can be put into a script and it will do exactly the same thing. Similarly, anything you can put into a script can also be run normally on the command line and it will do exactly the same thing.You don’t need to change anything. Just type the commands as you would normally and they will behave as they would normally. It’s just that instead of typing them at the command line we are now entering them into a plain text file. In this sense, if you know how to do stuff at the command line then you already know a fair bit in terms of Bash scripting.It is convention to give files that are Bash scripts an extension of .sh (myscript.sh for example). As you would be aware (and if you’re not maybe you should consider reviewing our Linux Tutorial), Linux is an extensionless system so a script doesn’t necessarily have to have this characteristic in order to work.A Bash Script Is A Plain Text File That Has As Its First Line #!/Bin/Bash And Has Its Permissions Modified To Be Executable. At The Top Of The Bash File, After The #!/Bin/Bash, It Should Have Your Name, Date And Class Section. You Can Add This To The Bash File With A Comment Line. Comment Lines In A Bash File Begin With #. The Top Of The Output FileA bash script is a plain text file that has as its first line #!/bin/bash and has its permissions modified to be executable. At the top of the bash file, after the #!/bin/bash, it should have your name, date and class section. You can add this to the bash file with a comment line. Comment lines in a bash file begin with #. The top of the output file should also have your name, date and class section. This can be done with the echo command.Linux BASH script that will output the information listed below to the following path /data_collection/sys_info.txt on the main hard drive of the computer. There should be a label eqabove the data in the output to make it more readable.Date – Time,System Name,Path,List of running processes include process id, parent process id and path,IP address on all network interfaces (both ifconfig and ip add show),List of user accounts,List of groupsThe bash file and the output from the script are what you will turn in for grading. If you have not already done so from lab 2 you will need to install WinSCP. The link to the webpage that hosts it can be found under the additional tools section. You can install this tool on your Windows server to copy your Linux script and output to your Windows server, where you can then use RDP to copy it to your local desktop.ash only looks in those specific directories and doesn’t consider sub directories or your current directory. It will look through those directories in order and execute the first instance of the program or script that it finds.The $PATH variable is an individual user variable so each user on a system may set it to suit themselves. This is done for a few different reasons.It allows us to have several different versions of a program installed. We can control which one gets executed based on where it sits in our $PATH.It allows for convenience. As you saw above, the first directory for myself is a bin directory in my home directory. This allows me to put my own scripts and programs there and then I can use them no matter where I am in the system by just typing their name. I could even create a script with the same name as a program (to act as a wrapper) if I wanted slightly different behaviour.It increases safety – For example a malicious user could create a script called ls which actually deletes everything in your home directory. You wouldn’t want to inadvertantly run that script. But as long as it’s not in your $PATH that won’t happen.If a program or script is not in one of the directories in your $PATH then you can run it by telling Bash where it should look to find it. You do so by including either an absolute or relative path in front of the program or script name. You’ll remember that dot ( . ) is actually a reference to your current directory. Assuming this script is in my home directory I could also have run it by using an absolute path.   Computer Science Engineering & Technology Python Programming COMM MISC Share QuestionEmailCopy link Comments (0)