Académique Documents
Professionnel Documents
Culture Documents
Submitted by:
Index
S. no
1. 2. 3. Shell Commands Shell Commands for Processes File commands Shell Scripting 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Shell Script for Displaying a message To accept name, age of the user and display it on the screen To find whether a number is even or odd To print the Fibonacci series To calculate the simple interest To calculate the factorial of a number To find whether a year is leap year or not To calculate the average of numbers given at command line To print a seven digit number in alternate sequence To count occurrence of a particular digit in inputted number Reverse a String 7 8 9 10 11 12 13 14 15 16 17
Programs
Page No
1 5 6
Remark
T. Sign
Shell commands
i) Command for making directory
root@mca113:/# mkdir mca root@mca113:/# cd mca root@mca113:/mca# cat> PROJ.sem there are 60 students in PROJ sem root@mca113:/mca# cd PROJ there are 60 students in PROJ sem
iii)Command for displaying date root@mca113:/# date Tue Mar 29 13:11:10 IST 2011
iv) Command for doing echo on screen root@mca113:/# echo " how are you " how are you
vii) Command for setting new password root@mca113:/# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
ix)
root@mca113:/# ls a1 avearge.sh~ boot fact.sh home lib mnt niec proc sev test1 var sev~ test.c
cdrom fact.sh~ initrd.img lost+found naina dev etc fib fib~ leap leap~ mca media
occur.sh root
srv tmp
avearge.sh bin
x) Command for knowing total process root@mca113:/# who root root root tty7 pts/0 pts/2 2011-03-29 11:32 (:0) 2011-03-29 11:35 (:0.0) 2011-03-29 12:59 (:0.0)
xi) Command for knowing name of login person root@mca113:/# who am i root pts/2 2011-03-29 12:59 (:0.0)
xi) Command for knowing user name of login person root@mca113:/# uname Linux
File commands
i) Command for counting total number of character line and word in a file
root@mca113:/# wc niec
1
4 15 niec
Shell Scripting
Program Display welcome screen
#WAP to display a simple welcome message echo "WELCOME TO SHELL SCRIPT"
Program To accept name, age of the user and display it on the screen
#WAP to accept name and age of the user and display it on the screen echo "Enter the name of the person: " read name echo "Now enter the age his age: " read age echo "The name of the person is $name and his age is $age"
in alternate