Skip to main content

Thread: shell script question: the "&" and "&&" sign


hi community:

"&" , "&&" signs mean in linux (unix) schell scripting? forgot!

i'm trying is
  1. first remove old copy of directory "bubba" in location i've backed of files,
  2. then copy current version of "bubba" backup location


(i've been using sbackup this, , want stop using it.)

in past i've done manually, using:

cd /home/philipsmith/wisdom
rm -r /home/philipsmith/wisdom/bubba


followed by

cp -a /home/philipsmith/bubba .

when rm completed.

want put whole thing in shell script , execute weekely crontab....

think need put "&" somewhere make sure rm completes before cp starts like:

cd /home/philipsmith/wisdom
rm -r /home/philipsmith/wisdom/bubba
& cp -a /home/philipsmith/bubba .

using "&" sign correctly in case, or should "&&" sign?

forgot!

thanks!
phil smith
duluth, ga

command & means "run command in background."

command1 && command2 means "run command1 , if completes successfully, run command2 afterwards."

should use &&. use & if want both commands run simultaneously.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support New to Ubuntu [ubuntu] shell script question: the "&" and "&&" sign


Ubuntu

Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support