28 jul 2011

Help Running Programs In Sequential Order

#!/bin/bash

#We launch glxgears on the background
glxgears&

#Capture its PID
pid="${!}"

#This waits until the program with the given PID ends
wait $pid

#Here we put more instructions, these will not be run until
#the wait command above unlocks the shell
echo "glxgears was closed, it's pid was $pid"

No hay comentarios:

Publicar un comentario