运维网's Archiver
论坛
›
Shell/Powershell
› shell编程基础知2
iojsioi
发表于 2018-8-19 10:56:40
shell编程基础知2
shift
ls -i -a
shift可以把$2变复制给$1处理
$$
当前命令的PID号,用于脚本只能同时执行一个。
# cat pid.sh
#!/bin/sh
pidpath=/tmp/a.pid
if [ -f "$pidpath" ]
then
kill -USR2 cat $pidpath>/dev/null 2>&1
rm -f $pidpath
fi
echo $$>/$pidpath
sleep 300
#
页:
[1]
查看完整版本:
shell编程基础知2