Bash Expansions
I'll come back to numbers before i post some cool features of bash.
Note that the '$' at the beginning of the line denotes the prompt.
1.Brace Expansion
$ echo alumn{a,i,ae,us}
alumna alumni alumnae alumnus
2.Tilde Exansion.
$ echo ~
/home/kalyan
3.Command substitution
$ ls $(which ls)
/bin/ls
Backticks also..
$ ls `which ls`
/bin/ls
4.Filename exapansion
$ ls s*
sd shift.sh string.sh stringcmp.sh
$ ls s?
sd
$ ls s[hd]*
sd shift.sh
5.Arithmetic Expansion
$ n=7
$ ((n=n+10))
$ echo $n
17
6.Paramenter expansion
$ ps=${ps:=lambadamda}
$ echo $ps
lambadamda
Note that the '$' at the beginning of the line denotes the prompt.
1.Brace Expansion
$ echo alumn{a,i,ae,us}
alumna alumni alumnae alumnus
2.Tilde Exansion.
$ echo ~
/home/kalyan
3.Command substitution
$ ls $(which ls)
/bin/ls
Backticks also..
$ ls `which ls`
/bin/ls
4.Filename exapansion
$ ls s*
sd shift.sh string.sh stringcmp.sh
$ ls s?
sd
$ ls s[hd]*
sd shift.sh
5.Arithmetic Expansion
$ n=7
$ ((n=n+10))
$ echo $n
17
6.Paramenter expansion
$ ps=${ps:=lambadamda}
$ echo $ps
lambadamda
0 Comments:
Post a Comment
<< Home