shell函数|常用命令|重定向
2016-03-16 11:03
197 查看
函数
函数定义
funWithReturn(){ echo "这个函数会对输入的两个数字进行相加运算..." echo "输入第一个数字: " read aNum echo "输入第二个数字: " read anotherNum echo "两个数字分别为 $aNum 和 $anotherNum !" return $(($aNum+$anotherNum)) } funWithReturn echo "输入的两个数字之和为 $? !"
参数
与获取脚本参数一样 $1 等常用命令
echo
单引号 不支持变量双引号 支持变量
-e 启用转义
echo `date` #输出时间
read
读取输入重定向
符号 | 说明 |
---|---|
command>file | 标准输出重定向 |
>> | 追加 |
>& | 合并 |
相关文章推荐
- shell流程控制
- bash alias 终极使用方法
- shell命令集
- adb shell后出现error解决方案
- adb shell后出现error解决方案
- shell运算符
- [shell]管理 Sphinx 启动|停止|重新生成索引的脚本
- shell
- 一个简单的遍历选定目录的PowerShell脚本
- shell脚本编程基础(1)及RAID阵列
- shell空数组
- shell二维数组
- shell一维数组
- 执行shell的时候开启调试模式
- SecureCRT连接Linux,操作HBase shell,不用使用Backspace键的设置方法
- Windows 10 IoT Raspberry Pi 2 相关PowerShell命令
- /bin/bash
- 高性能平台上提交任务的两种方式
- Hbase的shell命令
- 排序算法——shell排序