shell输入输出与|| &&

shell编程 3-6章

输入与输出 echo的使用 -e 打开特殊字符的转义功能 c 不换行 f 进纸 TAB 换行 当前行打印 echo -n 不换行 echo "string" string 使用单引号和双引号的区别 read的使用 echo -n "input your name:" && read name read -p "input your name:" name read -t 10 name #timeout read -a name #read into an array read -n 1 res read -s #不在控制台显示 类似密码输入 cat tac rev cat 1. cat file > file2 2. 使用cat得到特殊字符的ASCII码 有的不能显示 showkey -a 10进制 8进制 16进制 3. cat > file << eof 4. cat < eof 可以制作说明或者菜单 5 cat < sth 与 cat << sth 的区别 cat < file #显示file的内容 与 cat file输出相同 cat << sth #表示遇到sth退出cat 管道 tee ls > filename ls | tee filename 重定向 0 标准输入 1 标准输出 2 标准错误输出 ls xxx > file 如果ls xxx返回为0 , 那么标准输出写到file 如果ls xxx返回不为0 , 那么标准错误输出不会写到file 希望 错误输出和标准输出都写到file ls xxx 1>file # 不能有空格 , 同ls xxx > file ls xxx 2>file # 错误输出写入file ls xxx > file 2>&1 # 错误输出和标准输出重定向到file #把一个文件作为一个命令的输入 ls > file ls -l < file ls -l < file > file2 << delimiter # 从标准输入中读入 直到遇到delimiter command <&m # 把文件描述符m作为标准输入 command >&m # 把标准输出重定向到描述符m command <&- # 关闭标准输入 命令的执行顺序 && test -e z && echo "z exist...." test -e x && echo "x exist...." test -e z || echo "run" test -e x || echo "run" test -e x && echo "run 1" || echo "run 2" test -e z && echo "run 1" || echo "run 2" .和source 当前shell执行 bash 新建一个shell执行 () 子shell执行()里面的命令 {} 子shell执行 但是 一般用于函数 fun() { exit 1 }

<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>
阅读(703) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值