You are not logged in.
Pages: 1
Wow, I can't believe I didn't figure this out earlier (providing I actually did figure it out).
The '&&' will have the second command execute after the first completes, correct?
thx
"Ignorance is bliss, for stupid people."
"open-source is [...] programming Darwinism."
Vaughan-Nichols
Offline
hey, i learned something! cool!!
i didnt know about && but i use ; for the thing oyu mentioned
[damir@Asteraceae /]$ echo 'what?'; sleep 2;echo 'this!'
what?
this!
[damir@Asteraceae /]$ echo 'what?' && sleep 2 && echo 'this!'
what?
this!
[damir@Asteraceae /]$
and it seems, that ; is the same as && indeed
The impossible missions are the only ones which succeed.
Offline
&& will only run if the first command was completed successfully. It harkens back to the lazy conditional evaluation of C.
In contrast || will only run if the first command fails, which is why the default PKGBUILD has a 'make || return 1' in it
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
and If you want a second command to run after the first command completes, regardless of its return status, you just separate them with a ;
For example:
pacman -Syuw; hang; halt
ensures than my dialup connection will hang up and shut down in the middle of the night after downloading (but not installing) all the packages that are out of date. It will also hang up as soon as pacman chokes and quits without completing the download, saving my dialup hours.
Dusty
Offline
to use || (OR) in a script is logical, but && is the "AND", and (at least for me) does not make much sense using this way, so i never tried - funny - thanx for explaination
The impossible missions are the only ones which succeed.
Offline
Pages: 1