Open walterdejong opened 14 years ago
--- pconsole.sh.orig Wed Dec 29 10:37:44 2004
+++ pconsole.sh Wed Dec 29 11:24:29 2004
@@ -72,8 +72,13 @@
set -x
fi
- PS_PERSONALITY=posix # may be needed for GNU ps :P
- ps -ef 2>/dev/null | awk '{ print $3 " " $6 }' | egrep "^$1" | awk '{ print $2 }'
+ os=`uname`
+ if [ "$os" = "OpenBSD" -o "$os" = "FreeBSD" ]; then
+ ps -j 2>/dev/null | awk '{ print $3 " tty" $8 }' | egrep "^$1" | awk '{ print $2 }'
+ else
+ PS_PERSONALITY=posix # may be needed for GNU ps :P
+ ps -ef 2>/dev/null | awk '{ print $3 " " $6 }' | egrep "^$1" | awk '{ print $2 }'
+ fi
}
I'm not fond of checking OSes with uname, because NetBSD, DragonFlyBSD, MacOS X and others also use BSD ps. Maybe we can use "ps -ej", which works on Linux as well as BSD, only the output format is very different (?)
On BSD-ish systems, the ps command likes the -j argument rather than the -ef arguments used in pconsole.sh.
As pointed out a long time ago by both Marek Jaros and Davin Reade.