E_BADARGS=65
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` argument1 argument2 etc."
exit $E_BADARGS
fi
echo
index=1
for arg in "$*"
do
echo "Arg #$index = $arg"
let "index+=1"
done
echo "Entire arg list as single word."
echo
index=1
for arg in "$@"
do
echo "Arg #$index = $arg"
let "index+=1"
done
echo "Entire arg list as seperated words."
echo
index=1
for arg in $*
do
echo "Arg #$index = $arg"
let "index+=1"
done
echo "Entire arg list as seperated words."
echo
index=1
for arg in $@
do
echo "Arg #$index = $arg"
let "index+=1"
done
echo "Entire arg list as seperated words."
exit 0
执行结果:
$ ./test.sh bi yutong
Arg #1 = bi yutong
Entire arg list as single word.
Arg #1 = bi
Arg #2 = yutong
Entire arg list as seperated words.
Arg #1 = bi
Arg #2 = yutong
Entire arg list as seperated words.
Arg #1 = bi
Arg #2 = yutong
Entire arg list as seperated words
分享到:
相关推荐
cp -pr /etc/skel/.bash* /home/test/ ... 您可能感兴趣的文章:浅谈linux中shell变量$#,$@,$0,$1,$2的含义解释php $_SERVER windows系统与linux系统下的区别说明linux让$变成#符号的实操方法linux中$符号的基础用法教程
B shell与 C shell的区别 ; B shell的详解和C shell 的详解
进程状态变量 1、$$获取当前shell的进程号(PID) 2、$!执行上一个指令的PID 3、$?...$*和$@的区别 $*将所有的参数视为单个字符串,相当于“$1$2$3” $@将每个参数视为单个的字符串,保留命令行中的任
第一章 脚本编程与 Linux 命令Shell 脚本基础知识$1 入参,空值时默认赋值技巧$* 和 $@ 区别$* 和 $@ 都表示传递给函数或脚本的所有参数,
shell脚本与Makefile区别.docx
linux下常见4中shell脚本的区别
6. $* 和 $@的区别 当 $* 和 $@ 被双引号(” “)包含时, “$*”会将所有的参数作为一个整体,以“$1 $2 … $n”的形式输出所有的参数。 “$@”会以各个参数分开,以“$1”, “2”,…”2″ , …”2″,…”n”的...
# test7:用于对比各种脚本程序执行方式的区别 echo The variable var1 is $var1 echo The environment variable env1 is $env1 echo The current shell PID is $$ 1. 使用绝对路径执行脚本 测试过程 root@Dell-Tom...
主要介绍了linux下csh, tcsh,bash, sh等shell的区别?,需要的朋友可以参考下
ksh bash csh的区别,编写shell脚本需要注意的事项
在计算机科学中,Shell俗称壳(用来区别于核),是指“提供使用者使用界面”的软件(命令解析器)。它类似于DOS下的command和后来的cmd.exe。它接收用户命令,然后调用相应的应用程序。基本上shell分两大类: 一:...
android adb shell 命令大全 1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): android create avd --name 名称 --...
Shell 中的字符;变量;变量的类型;使用变量;扩展变量;变量的赋值与输出;Shell 的算术扩展;在 Shell 中计算时间;算术运算常用表达式;算术运算的优先级;变量递增的前置后置区别;熟悉 Shell 基础知识 掌握 Shell 脚本的...
这是我在做企业站的过程中发现的一些区别:(仅供参考) 一、$_SERVER[‘SERVER_NAME’] 在windows系统下,末尾是... 您可能感兴趣的文章:浅谈linux中shell变量$#,$@,$0,$1,$2的含义解释解决ssh远程登陆linux显示-bash-4
作用地位-比其他语言优势、建立一个规范的shell脚本、执行shell脚本的多种方法及重要区别精讲、shell脚本开发的9点基本规范和习惯、shell的变量-变量类型-全局变量相关知识讲解、shell的特殊变量-难点理论与实战剖析...
2、用sh直接执行shell和在java直接执行shell是有区别的,要在shell文件内增加oracle的环境变量即. /home/oracle/.bash_profile 这句话,否则在执行sqlldr会报如下异常: Message 2100 not found; No message file ...
主要介绍了shell中source、sh、bash、./执行脚本的区别,需要的朋友可以参考下
第11章 Linux/UNIX Shell类型与区别 273 第12章 子Shell与进程处理 288 第13章 函数 314 第14章 别名、列表及数组 335 第15章 一些混杂的主题 359 第16章 Shell脚本调试技术 403 第17章 bash Shell编程范例 ...
Linux下各种shell脚本编写需要注意的事项
shell字符串比较、判断是否为数字 二元比较操作符,比较变量或者比较数字。注意数字与字符串的区别。 整数比较 -eq 等于,如:if [ “$a” -eq “$b” ] -ne 不等于,如:if [ “$a” -ne “$b” ] -gt 大于,如:if [ “$...