Skip to content

Instantly share code, notes, and snippets.

@deostroll
Created March 25, 2016 06:43
Show Gist options
  • Select an option

  • Save deostroll/88320f2fcb7a1228c2e9 to your computer and use it in GitHub Desktop.

Select an option

Save deostroll/88320f2fcb7a1228c2e9 to your computer and use it in GitHub Desktop.
script to wait for process in bash shell
pid=$1
echo "pid is $pid"
check=1
while [ "$check" = "1" ]
do
val=$(ps | grep $pid | awk '{printf $1}')
#echo "$val"
if [ "$val" = "$pid" ]; then
sleep 1
else
check=0
fi
done
echo fin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment