Skip to content

Instantly share code, notes, and snippets.

@rhwlo
Created August 25, 2016 18:26
Show Gist options
  • Save rhwlo/8b5accadc6d086924a59e36d13644f35 to your computer and use it in GitHub Desktop.
Save rhwlo/8b5accadc6d086924a59e36d13644f35 to your computer and use it in GitHub Desktop.
background a process in another shell by pid, for @vruba
#!/bin/sh
ppid_tty=$(readlink /proc/$(cut -d' ' -f4 /proc/$1/stat)/fd/0)
kill -TSTP $1 && (/bin/echo "backgrounded $1" >> $ppid_tty) && kill -CONT $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment