Write a shell program to print knowledge is power on screen. Type the following command to open file:
#vi hello.ksh
The first line should be as follows:
#!/bin/ksh #vi hello.ksh
It is called a shebang. It consists of a number sign and an exclamation point character (#!), followed by the full path to the interpreter such as /bin/ksh. All scripts under UNIX execute using the interpreter specified on a first line.
Next append code as follows:
# A shell script to print message
# Written by Ninenok - Feb/5/2008
print "Knowledge is power"
Save and close the file. At the end your script should look like as follows:
#!/bin/ksh
# A shell script to print message
# Written by Ninenok - Feb/5/2008
# ------------------------------
print "Knowledge is power"
Set executable permission
Type the following command to set executable permission:chmod +x hello.ksh
Run your korn shell script
Type the following command:./hello.ksh
Sample output:
Knowledge is power
---------------------
..enjoy..:-)
No comments:
Post a Comment