ZKX's LAB

shell脚本中如何把输入传给子脚本或者子命令 Shell脚本read -p命令

2020-10-01知识7

shell脚本的read -p写法 echo-e\"\\nYourfullnameis:$firstname$lastname\"少个冒号 一个脚本sh02.sh是:#。bin/bashPATH=bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport 。

shell脚本的read -p写法 echo-e\"\\nYour full name is:$firstname$lastname少个冒号

shell脚本中如何把输入传给子脚本或者子命令 用命名管道啊。bin/bashif。e pipe];thenmkfifo pipefifunction father(){while read LINEdoecho$LINEdone}function son(){while read subLINEdoecho from pipe:$subLINEdone}sonson后台从管道pipe中读取,你的子shell也用这种方法运行。father>;./pipefather 前台写入到pipe管道中

unix 的shell中read命令前加prompt是什么意思 read 命令抄是用来读取用户输入的,前面加prompt就是停下来等待输入的时候百给个提示,比如:read-p\"Please input:\"var你运行下度就知道了。知后面一个问题不知道你什么意思。文件名称不也是字符串吗?道

linux 中read命令后面-p是什么意思呢 p是prompt的缩写,即由这个开关项给出提示信息,例如 read-p 'please input you choice:\\n' choice 回车后屏幕会显示: please input you choice: 那么之后你输入的东西就。

shell编程 read -p 命令不能执行 if语句本来就是执行某一个满足条件的语句,你把man的赋值百在$ID-eq 1 的时候,这时候是执行不到度$man=$y下面的语句体的,它会跳过这个,这时候if语句执行完毕版。你写的本来就有问题。两个if语句嵌套就好了。bin/shy=yn=nID=$(ps-ef|grep tomcat|grep-v grep|grep tomcat|awk '{print$3}')echo\"this is tomcat start/stop shellif[$ID-eq 1]#当ID=1 表示权tomcat 开启 如果是执行下面的参数thenread-p\"y or n:\"man#read-p 输入一个变量 manif[$man=$y]#在判断如果输入的是ythen(/home/tomcat/apache-tomcat-8.5.5/bin/shutdown.sh)#fiecho\"yes is stop tomcatelseecho\"errorfi

linux shell 跳过read命令,怎么解决?

#bin#shell编程#linux脚本#read#shell

随机阅读

qrcode
访问手机版