1. Two methods of setting login prompt
(1)/ETC/MOTD
[[email protected] thzzc]# echo this is THZZC test Linux >/ETC/MOTD
[Email protected] thzzc]# CAT/ETC/MOTD
This is THZZC test Linux
(2)/ETC/PROFILE.D
[Email protected] home]# echo echo This is THZZC test Linux >/etc/profile.d/test.sh
[Email protected] home]# cat/etc/profile.d/test.sh
echo This is THZZC test Linux
2, single quotes, double quotes, non-quoted differences example
(1) [[email protected] ~]# cat test.sh
a=192.168.1.1
b= ' 192.168.1.1 '
C= "192.168.1.1"
echo a= $a
Echo b= $b
Echo c= $c
[Email protected] ~]# sh test.sh
a=192.168.1.1
b=192.168.1.1
c=192.168.1.1
(2) [[email protected] ~]# cat test.sh
a=192.168.1.1
A=192.168.1.1-$a
b= ' 192.168.1.1-$a '
c= "192.168.1.1-$a"
echo a= $a
Echo b= $b
Echo c= $c
[Email protected] ~]# sh test.sh
a=192.168.1.1-192.168.1.1
B=192.168.1.1-$a
c=192.168.1.1-192.168.1.1-192.168.1.1
3. awk single quote, double quotation mark abnormal case
[Email protected] ~]# oldboy=123
[[email protected] ~]# awk ' BEGIN {print ' $oldboy '} '
$oldboy
[[email protected] ~]# awk ' BEGIN {print $oldboy} '
[[email protected] ~]# awk ' BEGIN {print ' $oldboy '} '
123
[[email protected] ~]# awk ' BEGIN {print "' $oldboy '"} '
123
With awk, the opposite is the case, with single quotes, double + single resolution variables, and double quotes as output. Nothing adds output to null.
Summary: If you want to output the same as the double quotation marks, the resolution variable with double + single (' xxx ')
The old boy for convenience, generally not directly with awk, but using the method of the pipeline, first echo variable let the pipeline through the second pass the parameter.
[Email protected] ~]# oldboy=123
[[email protected] ~]# echo $oldboy |awk ' {print $} '
123
[[email protected] ~]# echo ' $oldboy ' |awk ' {print $} '
$oldboy
[[email protected] ~]# echo "$oldboy" |awk ' {print $} '
123
Both SED and grep are consistent with previous conclusions, and awk is odd. Awk is really a language!
Shell programming in the 3rd chapter of Shell Variable Foundation (bottom)