How do I write a script to execute a few commands?
Let's say I wanted to open a file and a folder.
|
Quote:
cd Test; cat Test.txt |
Or && if the execution of a command depends on the exit status of the previous one.
|
Quote:
|
Quote:
|
The simplest script is basically just a text file with the commands you want to run stored one-per-line. When one command exits, the next one is executed.
But there's also a whole suite of shell syntax commands that let you do much more if desired. Variables, loops, branching statements, etc. Here's my usual list of bash resources. Read through the first two at least. The BashGuide covers all the basic concepts in an easy-to-read form, while linuxcommand is more learn-by-doing, taking you step-by-step. http://mywiki.wooledge.org/BashGuide http://www.linuxcommand.org/index.php http://mywiki.wooledge.org/BashFAQ http://mywiki.wooledge.org/BashPitfalls http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/index.html http://www.gnu.org/software/bash/manual/bashref.html http://wiki.bash-hackers.org/start http://ss64.com/bash/ |
All times are GMT -5. The time now is 10:41 PM. |