Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux -s和-p如何更改read命令?_Linux_Bash_Unix - Fatal编程技术网

Linux -s和-p如何更改read命令?

Linux -s和-p如何更改read命令?,linux,bash,unix,Linux,Bash,Unix,我试图解释这段代码。搜索谷歌,看看这些命令意味着什么,没有运气。我解释了每一行/每一块对我意味着什么。如果我错了,请纠正我。我不熟悉unix命令。代码: #!/bin/bash # input 1st command line argument for the version. export VERSION=$1 # if user didn't input a version, print the echo message and exit (not sure what -n

我试图解释这段代码。搜索谷歌,看看这些命令意味着什么,没有运气。我解释了每一行/每一块对我意味着什么。如果我错了,请纠正我。我不熟悉unix命令。代码:

#!/bin/bash    

# input 1st command line argument for the version.  
export VERSION=$1

# if user didn't input a version, print the echo message and exit (not sure what -n means but I am assuming)
if [[ ! -n "$VERSION" ]]; then
    echo "Missing Version"
    exit 1
fi

# creating variable UNAME that tells who the person is (their name)
export UNAME='whoami'

# no idea what -s and -p mean but i think this prints the message "enter password for $UNAME" and stores it in a new variable named PASSWORD. the $UNAME will print whatever whoami said.
read -s -p "Enter password for $UNAME: " PASSWORD
echo ""

在将输入读入变量之前,-p标志会发出提示

-s标志阻止显示键入的响应(例如,对于敏感密码)

有关更多信息,请访问:


在将输入读取到变量之前,-p标志会发出提示

-s标志阻止显示键入的响应(例如,对于敏感密码)

有关更多信息,请访问:

prompt输出字符串提示符,之前不带尾随换行符 正在尝试阅读

不要回显来自终端的输入

prompt输出字符串提示符,之前不带尾随换行符 正在尝试阅读

不要回显来自终端的输入


read
是一个shell内置程序,请尝试
help read
了解它的工作原理。谢谢。完全忘记了帮助命令。您可能还需要
-r
这里。还有
read
是一个shell内置程序,请尝试
help read
了解它的工作原理。谢谢。完全忘记了帮助命令。您可能还需要
-r
,这里还有
  -p
  -s