Building Unix Shell Script Files


In our shell script example, we saw that lines of text (such as commands with REs) could be entered into the shell prompt (command interpreter) and executed. This is not necessarily a script file because it is not in a file. It's just being added to the prompt and executed immediately.

The other way to do this would be to use those lines (so you don't have to type them) to identically add them to a file that you can run to execute its contents. In other words, when you boot up your system and login, you can have your email opened, and run a cron job, maybe open the vi editoryou add all these to the file, save it, and then run that file. By typing the name of the file at the shell prompt, it will execute the file's contents, which should be multiple commands and REs. You have just entered the ranks of the prestigious, the shell scripter.

Once constructed and saved, your script will produce exactly the results outlined at the beginning of this section. Again, make sure that you run the correct script against the correct shell.



    SAMS Teach Yourself Unix in 10 Minutes
    Sams Teach Yourself Unix in 10 Minutes (2nd Edition)
    ISBN: 0672327643
    EAN: 2147483647
    Year: 2005
    Pages: 170

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net