Download presentation
Presentation is loading. Please wait.
Published byRichard Perry Modified over 9 years ago
1
Day 12 Intro to Shell Scripting
2
Doing it all together Up until now, we have only used built in functions in Unix. What if we want to define our own functions? –Using the built in commands, we might want to put many of them together to do something more useful.
3
Shell Script A shell script is a text file which you might create using vi. –You enter the commands you want to run, just as if you were at a shell prompt. –The file can have as many commands as you like in it. Once you make the file you MUST change its permissions to include eXecute permission for whoever should be able to run it. –Typically you will do: chmod u+x script
4
Simple Script Create a script which will look through the contents of the file test.txt and will find out how many lines the letter C is on.
5
Finding friends For now, work with your cousin and create: –A shell script which will tell you which of your friends are currently logged on. –Call the script whoon –You will probably need the commands who egrep –Be sure you can just type whoon from the command prompt to make it run.
6
Now modify your friends script Make its output be like this: Date: Mon Feb 12 11:09:39 EST 2001 Number logged in: 12 Your Friends: enda afriend
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.