Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


More on LinuxToday


Linux Command Sequences in the Bash Shell

Dec 10, 2010, 07:04 (0 Talkback[s])

[ Thanks to Andrew Weber for this link. ]

"In addition to creating programming structures, you can also use the semi-colon to separate stand-alone commands that you want to execute from the same command entry. If you wanted to cd to a certain directory and then look at its contents, you could enter each command on its own line. Or, you could enter them both on the same line. This process is called command chaining.
cd /var;ls
backups  crash  lib    lock  mail  run    tmp  yp
cache    games  local  log   opt   spool  www

"You can also instruct bash to only execute the second command if the first command successfully completes. Just separate the commands with an "&&" instead of with a semi-colon."

Complete Story

Related Stories: