Thread: shell script question: the "&" and "&&" sign
hi community:
"&" , "&&" signs mean in linux (unix) schell scripting? forgot!
i'm trying is
- first remove old copy of directory "bubba" in location i've backed of files,
- 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
Post a Comment