终端工具
tput和stty是两款终端处理工具
tput cols,lines,longname,cpu 100 100
输入密码时,不能让输入的内容显示出来。用stty
#!/bin/bash #Filename:password.sh function enterpassword(){ echo -e "Enter password" stty -echo read password stty echo echo password read } enterpassword
tr 命令
#!/bin/bash #使用tr进行转换 #tr 可以进行替换,删除,压缩 #tr 只能通过stdin,而无法通过命令行参数来接受输入。他的调用格式如下 #替换 echo "Hello who IS ThIs" | tr 'A-M,n-z' 'a-m,N-Z'
#删除 echo "hello 0980world" | tr -d '0-9'
#压缩的话可以使用 tr -s 来实现#把 文件中的 换行符 压缩成单个字符 cat file.txt|tr -s ' ' #给内容加上行号 cat -n file.txt