全部博文(136)
分类: LINUX
2008-12-12 23:30:12
[root@localhost ~]# var1 = 10 bash: var1: command not found [root@localhost ~]# var1= 10 bash: 10: command not found [root@localhost ~]# var1=10 [root@localhost ~]# echo $var1 10 |
[root@localhost ~]# .var1=10 bash: .var1=10: command not found [root@localhost ~]# 1var1=10 bash: 1var1=10: command not found |
[root@localhost ~]# var1=10 ms bash: ms: command not found [root@localhost ~]# var1='10 ms' [root@localhost ~]# echo var1 var1 [root@localhost ~]# var1="10 ms" [root@localhost ~]# echo var1 var1 |
[root@localhost ~]# var1='c:\\' [root@localhost ~]# echo $var1 c:\\ [root@localhost ~]# var1="c:\\" [root@localhost ~]# echo $var1 c:\ |
[root@localhost ~]# var1=\ > yuechaotian [root@localhost ~]# echo $var1 yuechaotian [root@localhost ~]# var1=\\ [root@localhost ~]# echo $var1 \ [root@localhost ~]# var1=\' [root@localhost ~]# echo $var1 ' [root@localhost ~]# var1=\" [root@localhost ~]# echo $var1 " [root@localhost ~]# var1=It\'s\ mine [root@localhost ~]# echo $var1 It's mine [root@localhost ~]# var1=$HOME [root@localhost ~]# echo $var1 /root [root@localhost ~]# var1=\$HOME [root@localhost ~]# echo $var1 $HOME |
[root@localhost ~]# var1="$var1"yuechaotian [root@localhost ~]# echo $var1 $HOMEyuechaotian |
[root@localhost ~]# var1=$var1:neu [root@localhost ~]# echo $var1 $HOMEyuechaotian:neu [root@localhost ~]# var1=$var1*male [root@localhost ~]# echo $var1 $HOMEyuechaotian:neu*male [root@localhost ~]# var1=$var1/linux [root@localhost ~]# echo $var1 $HOMEyuechaotian:neu*male/linux [root@localhost ~]# var1=$var1-oracle [root@localhost ~]# echo $var1 $HOMEyuechaotian:neu*male/linux-oracle |
# 7.1 在新开启的子程序中,找不到变量var1 [root@localhost ~]# var1="How are you?" [root@localhost ~]# echo $var1 How are you? [root@localhost ~]# /bin/bash [root@localhost ~]# echo $var1 [root@localhost ~]# exit exit [root@localhost ~]# echo $var1 How are you? # 7.2 将变量export后,子程序中即可使用 [root@localhost ~]# export var1 [root@localhost ~]# /bin/bash [root@localhost ~]# echo $var1 How are you? |
[root@localhost ~]# uname -r 2.6.9-42.EL [root@localhost ~]# var1="My Kernel is "`uname -r` [root@localhost ~]# echo $var1 My Kernel is 2.6.9-42.EL |
[root@localhost ~]# unset var1 [root@localhost ~]# echo $var1 [root@localhost ~]# |