t*******l 发帖数: 421 | 1 # who
john pts/3 Sep 2 11:11 (903980497497)
# echo $argv[1]
Subscript out of range
what is wrong? |
o***z 发帖数: 133 | 2
1太大就换$argv[0]嘛
实在不行man echo
【在 t*******l 的大作中提到】 : # who : john pts/3 Sep 2 11:11 (903980497497) : # echo $argv[1] : Subscript out of range : what is wrong?
|
t*******l 发帖数: 421 | 3 echo $argv[0] returns nothing !
pls help more! |
o***z 发帖数: 133 | 4 what do you want?
【在 t*******l 的大作中提到】 : echo $argv[0] returns nothing ! : pls help more!
|
t*******l 发帖数: 421 | 5 # who
jane pts/4 Sep 2 2:30 (oweoiutoiuywroitu)
I want it echo the user name "jane", so I use the following :
# echo $argv[1]
error
# echo $argv[0]
#
nothing returned. |
r**a 发帖数: 630 | 6 对您的佩服如滔滔江水。。。。。。。
【在 t*******l 的大作中提到】 : # who : jane pts/4 Sep 2 2:30 (oweoiutoiuywroitu) : I want it echo the user name "jane", so I use the following : : # echo $argv[1] : error : # echo $argv[0] : # : nothing returned.
|
o***z 发帖数: 133 | 7 or try
who -q | grep -v "^#"
【在 t*******l 的大作中提到】 : # who : jane pts/4 Sep 2 2:30 (oweoiutoiuywroitu) : I want it echo the user name "jane", so I use the following : : # echo $argv[1] : error : # echo $argv[0] : # : nothing returned.
|
t*******l 发帖数: 421 | 8 don't say so...
I am a beginner of unix.
【在 r**a 的大作中提到】 : 对您的佩服如滔滔江水。。。。。。。
|
t*******l 发帖数: 421 | 9 perfect!
thanks for teaching !
【在 o***z 的大作中提到】 : or try : who -q | grep -v "^#"
|
r**a 发帖数: 630 | 10 不如用whoami算了
那个grep -v "^#" 屁用没有,hoho!
【在 o***z 的大作中提到】 : or try : who -q | grep -v "^#"
|
|
|
t*******l 发帖数: 421 | 11 but I learn about grep -v "^#" at the same time! :))))
it is useful to me.
also , I learn "whoami" this time too!
also great! |
r**a 发帖数: 630 | 12 hoho! Good luck lah!
【在 t*******l 的大作中提到】 : but I learn about grep -v "^#" at the same time! :)))) : it is useful to me. : also , I learn "whoami" this time too! : also great!
|
r**a 发帖数: 630 | 13 if u insist to use echo, then:
echo `whoami`
【在 t*******l 的大作中提到】 : but I learn about grep -v "^#" at the same time! :)))) : it is useful to me. : also , I learn "whoami" this time too! : also great!
|
t*******l 发帖数: 421 | 14 great.
see, unix is so versatile, so flexible.
that is why I LOVE IT!
I have to learn it, try to be perfect! |
t*******l 发帖数: 421 | 15 but I still want to know why echo $argv[1] and echo $argv[0] doesn't work.
【在 r**a 的大作中提到】 : if u insist to use echo, then: : echo `whoami`
|
r**a 发帖数: 630 | 16 因为你在shell里面调用$argv[0],这个$argv[0]就应该是shell被调用时传入的第一个
参数,但是你的shell在初始化时根本没有输入参数。另外,脚本变元应该是$0、$1的
格式。
【在 t*******l 的大作中提到】 : but I still want to know why echo $argv[1] and echo $argv[0] doesn't work.
|
d****i 发帖数: 4354 | 17 try
who | awk '{print $1}'
【在 t*******l 的大作中提到】 : # who : jane pts/4 Sep 2 2:30 (oweoiutoiuywroitu) : I want it echo the user name "jane", so I use the following : : # echo $argv[1] : error : # echo $argv[0] : # : nothing returned.
|
t*******l 发帖数: 421 | 18 right,this works perfectly.
thanks.
【在 d****i 的大作中提到】 : try : who | awk '{print $1}'
|