美文网首页
Shell编程之变量

Shell编程之变量

作者: lupinwu | 来源:发表于2017-03-11 09:49 被阅读0次
    overview.png

    位置环境变量

    num1=$1
    num2=$2
    sum=$(($num1+$num2))
    echo $sum
    

    预定义变量

    echo "para is : $*"
    echo "para is : $@"
    echo "para num: $#"
    
    for i in "$*"
            do
                    echo "The parameters are: $i"
            done
    
    
    for i in "$@"
            do
                    echo "The parameters are: $i"
            done
    
    echo "Current : $$"
    
    find / -name hello.sh &
    echo "background : $!"
    *后台进程号$!未实现
    

    read语句

    read -p "please input your name: " -t 3 name
    echo $name
    
    read -p "please input your password: " -s passwd
    echo -e "\n"
    echo $passwd
    
    read -p "please input your sex [M/F]: " -n 1 sex
    echo -e "\n"
    echo $sex
    

    相关文章

      网友评论

          本文标题:Shell编程之变量

          本文链接:https://www.haomeiwen.com/subject/grrogttx.html