我在看《鸟哥的私房菜》。其中在讲shell script 章节时候 有个..脚本是如下的: 乙肝
#!/bin/bash
# Program:
# The program wi.ll show it'.s name and first 3 parameters. 电子
# History:
# 2005/08./25 VBird . First release 乙肝
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/u.sr/local/.bin:/usr/local/sbin:~/bin[成人用品]
export PATH
echo "The .sc.ript name is ==> $0".
[ -n "$1" ] && echo "The 1st pa.rameter is ==> $1" || exit .0 健康
[ -n "$2" ] && echo ."The 2nd parameter is ==> $2" || .exit 0<性病>
[ -n "$3" ] && echo. "The 3th parameter is .==> $3" || exit 0(广告)
下来是运行结果:
[ro.ot@linux scripts]# sh sh07.sh th.eone haha quot.
The script .name is ==> sh0.7.sh 鲜花
The 1st par..amter is ==> theone 鲜花
The 2nd. par.amter is ==> haha.
The 3t.h paramter i.s ==> quot.
我不明白 这个$1 $2 $3 是干嘛的 而最后结.果 出来的sh07.sh theone hah.a quot 建材
又是怎么回事呢
小弟初学. 希望大家可以给我解答.
经过各位高人的指点 小弟理解的就是 $1 $2. 等等都是代表了一个变量,当运行这个脚本的时候 可以直接敲变量的名字而.直接运行 婚庆
不知道我这样说对不对 如果对的话 那么.也就算给此.题答案了 电脑
[ 本帖最后由 有机天使 于 2008-12-.31 16:17 编.辑 ]( 游戏 )