shell 学习
新手写shell 积累ing 这里报错: read -p "please input Y/N: " yn
if [ $yn == "Y" ]||[ $yn == "y" ] ; then
echo "input yes"
elif [ $yn == "n" ]||[ $yn =="N" ]; then
echo "input No"
else
echo "input error"
fi
执行结果报错: 问题 2: read -p "please input: " h
if [[ "$1" == "hello" ]]; then
echo "hello,nice to meet you"
#elif [ $1 == " " ];then
# echo "you must input parameter!!"
else
echo "the input is: " " $h"
fi
一直没有得到正确的结果 在 -x 调试的时候发现
ash$ ./hello.sh build test
bash$ list.sh -sh --debug /home/user
当脚本接受命令行参数时,美元符加数字就可以引用这些参数。 在
创建、删除的命令 问题3 path=$(pwd)#一定要有() echo“ `pwd` ” 将命令结果赋值给变量 var=$(cmd)
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |