几个read用法

几个read用法

read -p "how old r u? " age
echo $age
read -p "some words? " -a words
echo ${words
  • }
    read -p "Password: " -s passwd                                 
    echo $passwd
    read -t 5 auth
    echo $auth
    read -n 1 key
    read -dq -p "input something end with q: " menu
  • 变量长度
    echo $name | awk '{printf("%d",length($1))}'