O'Reilly logo

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

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple Script

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required