Skip to content

Commit 90ef9f5

Browse files
committed
show the cmdline of the recursively by its ppid
1 parent dc74986 commit 90ef9f5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

functions/process/pstree2.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
# Create Date: 2021/5/10
88
# Create Time: 22:24
99

10-
1110
#if [ "$(id -u)" != "0" ]; then
1211
# echo "WARNING: This script should be run as root" 2>&1
1312
#fi
@@ -26,8 +25,8 @@ ps -ef | grep "$current_pid_grep" | awk -v pid="$current_pid" '$2==pid' | grep "
2625
current_ppid="$(ps -ef | grep "$current_pid_grep" | awk -v ppid="$current_pid" '$2==ppid {print $3}')"
2726

2827
if [[ "$current_ppid" == "" || "$current_ppid" == "0" ]]; then
29-
echo "the pid not exists."
30-
exit 1
28+
echo "the pid not exists."
29+
exit 1
3130
fi
3231

3332
while [[ $current_ppid -ne 1 ]]; do
@@ -41,4 +40,4 @@ while [[ $current_ppid -ne 1 ]]; do
4140
if [[ $current_ppid -eq 1 ]]; then
4241
break
4342
fi
44-
done
43+
done

0 commit comments

Comments
 (0)