Simple Script

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Chapter 2.  Korn Shell Basics


Most of this chapter deals with how the Korn shell interacts with Unix , but to briefly explain the scripting concept a very simple example is provided. First of all, ls is a Unix command that lists the name of the files in the current directory, and print is a Korn shell command that displays its argument. Using your favorite Unix editor, enter the following text into a file called simple_script.ksh:

 print "Here are the current files:"  ls 

Assuming that you are using the Korn shell, have execute permission in your default umask and that you have the current path included in your environment (this will also be covered later!), run the script like this:

 $ simple_script.ksh  Here are the current files:  simple_script.ksh  /tmp         report.txt 

If this does not work, you cna also try running the script like this:

 $  ksh simple_script.ksh  Here are the current files:  simple_script.ksh  tmp    report.txt 

As you can see, a script is just a 'batch' file of commands that is passed to the Korn shell to be executed. More about writing Korn shell scripts is covered in Chapter 8.


       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

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