tmux-resurrect/save_command_strategies/ps.sh
Bruno Sutic 9dc3f8c639
Always use 'ps -ao' to detect commands
Previously we used 'ps -eo' for some operating systems. It turns out
flags '-ao' work fine for all, and it should also be fine per posix spec

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html#tag_20_96
2018-09-11 11:16:30 +02:00

25 lines
337 B
Bash
Executable File

#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PANE_PID="$1"
exit_safely_if_empty_ppid() {
if [ -z "$PANE_PID" ]; then
exit 0
fi
}
full_command() {
ps -ao "ppid command" |
sed "s/^ *//" |
grep "^${PANE_PID}" |
cut -d' ' -f2-
}
main() {
exit_safely_if_empty_ppid
full_command
}
main