【发布时间】:2022-01-12 12:06:42
【问题描述】:
在下面的程序中,我可以打印出显着的ppid来打印pid,
我想知道答案,pid很重要所以我要打印出来
#! /bin/bash
echo " a.display PTD of parent and child "
echo " b. copy the file content "
echo " enter your choice "
read ch
case $ch in
a)
echo " parent pid is $PPID"
echo " pid is $PID"
;;
b)
echo "enter a source file"
read f1
echo "enter destination file "
read f2
if [ -f $f1 ]
then
cp $f1 $f2
else
echo "file does not exist"
fi
;;
esac
【问题讨论】:
-
我不明白要求。您要打印哪个进程的PID? bash脚本本身的进程存放在
$$中。