LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash: "after" or "waitfor" command (https://www.linuxquestions.org/questions/programming-9/bash-after-or-waitfor-command-333115/)

enemorales 06-13-2005 11:42 AM

Bash: "after" or "waitfor" command
 
Hi,

Is there a command that waits until a process is finished and then excecutes another one? I know I can do things like

Code:

command1 && command2
but what happens if I run only command1 and then change my mind and want command2 to be run once command1 has finished? (for instance, if command1 takes too long and I want to go to sleep, but shutdown my machine once command1 finishes). Is there something like

Code:

command1
after command1 command2

??

Thank you very much in advance!!

keefaz 06-13-2005 12:25 PM

You can always type command2 in the shell even before
command1 ends but you will have to type return to
validate it so you could'nt be able to edit it

AltF4 06-13-2005 12:30 PM

$ command 1 &
$ wait; command2

enemorales 06-15-2005 12:04 AM

Thank you!


All times are GMT -5. The time now is 01:57 AM.