标签:
shell基础二十篇
转自 http://bbs.chinaunix.net/thread-452942-1-1.html
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
read -e file #在这试试命令历史和补齐功能
我认为read ?很好用,比echo "input:";read input...用简便!像这样:
read input?"input:"
echo $input
而且read a b c这样用也很实用:
echo -n "please year month day"
read a b c
echo $a $b $c
另外就是read读fd,比如常用的两个文件的拼接:
while read -u3 i && read -u4 j;do
echo $i $j
done 3<afile 4<bfile
标签:
原文地址:http://www.cnblogs.com/ph829/p/4648117.html