changeset 6884:ccc447c7c094

<shachaf> ` >bin/cmd echo -e \'#!/bin/bash\\npid="$PPID"\\n[ -n "$1" ] && pid="$1"; cut -d "" -f 3 < /proc/$pid/cmdline\'
author HackBot
date Tue, 16 Feb 2016 02:06:54 +0000
parents 6ef896cf3bbb
children 4386cf0a608d
files bin/cmd
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bin/cmd	Tue Feb 16 02:04:17 2016 +0000
+++ b/bin/cmd	Tue Feb 16 02:06:54 2016 +0000
@@ -1,2 +1,3 @@
 #!/bin/bash
-cut -d "" -f 3 < /proc/$1/cmdline
+pid="$PPID"
+[ -n "$1" ] && pid="$1"; cut -d "" -f 3 < /proc/$pid/cmdline