You are on page 1of 2

in linx shell these two variables

- system variables
1. write a full scsript based on this
echo "Enter your first name"
read fname
echo "Hello $fname, how is shell scripting"
to execute first use
* chmod 755 filename
to display the output
* ./filename
2.What dose
1. ls /bin/[!a-o]
2. ls /bin/[*a-o]
3. ls a* // a string start by a
4. ls ab? // the string is consiste of three character only and show me
the threed charcter
5. ls [abc*]
3. echo "Total no of command line arguments are $#"
echo "$0 is script name!"
echo "$1 is first argument!"
echo "$2 is secend argument!"
echo "All the arguments are : $# or $@
to execute the above script
* chmod 755 filename
./filename
./filename arguments with space separater
Input and out put redirection
To redirect input from the standard input(KB) or output into hte standard output
(stream) from/to a file
eg
1. ls > myfilelist
2. cat > myfilelist
sort < myfilelist > myfilelist_sorted
3. tr "[a-z]" "[A-Z]" < myfilelist > myfilelist_caps
from
to
filename
filename after conversion
pipes
this are used to interconnect the output of the program to the other
- syntax: command1|command2
eg
1. ls | less
2. ls | more
3. ls -l | wc -l
4. who | group name
filters {uniq,wc,grep,sort head,tail,tee}
=> accept input, modifiy it and produce another input
eg

1.
2.
3.
4.

ls /usr/bin/ | tee ls.txt | greep zip


tail -f /var/log/messages
head -a $ ls txt
ls /bin /usr/bin/ |sort |uniq |wc -l

You might also like