shell常用基本命令之七 shift
来源:互联网 发布:java重载函数 参数子类 编辑:程序博客网 时间:2024/06/01 12:14
1.shift的功能
1.所有的位置参数都左移1位,即$2变$1,$3变$2
2.$# 减1
2.举例
[root@nn shell]# cat shift_fun.sh#!/bin/bash echo "number of arguments is $#"echo "What you input is:"while [[ "$*" != "" ]]do echo "$1"shiftdone[root@nn shell]# ./shift_fun.sh hello worldnumber of arguments is 2What you input is:helloworld[root@nn shell]#shift就是起到移位的作用
#!/bin/bash while [ "$#" -gt 0 ]do echo $*shiftdone运行结果:[root@nn shell]# ./shift_fun1.sh 9 8 7 6 5 4 3 2 19 8 7 6 5 4 3 2 18 7 6 5 4 3 2 17 6 5 4 3 2 16 5 4 3 2 15 4 3 2 14 3 2 13 2 12 11
0 0
- shell常用基本命令之七 shift
- linux 常用基本命令之七 tar
- linux shell脚本之 shift (n)命令
- 常用Shell基本命令
- 常用Shell基本命令
- shell 内置命令shift
- shell中的shift命令
- linux shell命令shift
- shell常用的基本命令
- Shell之shift
- shell命令之基本的shell命令
- Linux Shell中的shift命令
- zeus之shell基本命令
- Linux 之基本 shell 命令
- Hbase之Shell基本命令
- Linux Shell 常用shell命令(三)基本系统命令
- Shell编程之shift使用
- Linux之常用Shell命令
- 工具类整理--两次点击BACK键,退出应用的实现
- 1013. Battle Over Cities (25)
- Objective-C的基础setter和getter
- Sublime插件:Markdown篇
- 蓝牙BLE 架构剖析
- shell常用基本命令之七 shift
- IP协议、ARP协议、RARP协议
- Unix & Linux 笔记(9)
- poj 2815 城堡问题(搜索)
- 管理是什么
- HttpClient使用详解
- Windows下Cordova环境搭建及如何用android studio导入cordova项目生成apk
- 最少拦截系统 hdu 1257
- Java Project项目在Linux下部署步骤及注意事项