ZKX's LAB

linux删除shell脚本命令 Linux shell脚本如何自动运行程序并输入命令

2021-04-07知识10

Linux shell脚本如何自动运行程序并输入命令 我建议你使用shell的spawn命令,很好用的,能实现你说的功能!

linux shell脚本切换用户执行一段命令 ls-l/bin/echo 看看echo命令的权限是什么 如果其他用户没有执行权限,就切到root下加一下x权限chmod o+x/bin/echo

Linux如何删除指定行,用shell脚本实现 #。bin/shFILENAME=file.txt#可换为$1if。f file.txt];thenecho\"$FILENAME no foundexit 1fiecho-n\"INPUT SOME THING:readif。z”$REPLY“];thenINFO=$(grep$REPLY FILENAME)if。z\"$INFO\"];thensed-i-e '/$REPLY/d' FILENAME#删除只用这行就可以了elseecho\"没有指定内容的信息exit 1fielseecho\"input some thingexit 1fiexit$?

随机阅读

qrcode
访问手机版