我正在尝试解释这段代码。搜索谷歌看看这些命令的含义,但没有运气。我把我对每一行/块对我意味着什么的解释。如果我错了,请纠正我。我是 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 标志阻止显示键入的响应(即对于敏感密码)
更多信息请点击这里:
https://linuxhint.com/bash_read_command/ https://linuxhint.com/bash_read_command/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)