Skip to content

Instantly share code, notes, and snippets.

@ryul99
Created August 10, 2023 07:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryul99/6c77b4dbdd1af7d67c71ee209b5b4b7c to your computer and use it in GitHub Desktop.
Save ryul99/6c77b4dbdd1af7d67c71ee209b5b4b7c to your computer and use it in GitHub Desktop.
wait function for any pid without see "pid is not a child of this shell"
#!/usr/bin/env bash
# https://unix.stackexchange.com/a/427133
if [ `uname` == "Linux" ]; then
tail --pid=$1 -f /dev/null
else
lsof -p $1 +r 1 &>/dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment