How to execute ksh files in Fedora Core 4?
I am new to linux. I have installed Fedora Core(2.6.11-1.1369_FC4) in my pc. I have written a simple ksh script and stored it in welcome.ksh .
I am trying to execute welcome.ksh file by typing "welcome.ksh" in terminal, but not sure why it throws an error saying "command not found". The file "welcome.ksh": echo "Welcome to Unix" Let me know how to execute the script in terminal. Thanks in Advance. |
Quote:
Also, you probably want to install a newer version of Fedora, since 4 is out of date and probably no longer supported. The latest version is 9. |
In addition to the PATH information given...
The source code for a shell program may have an extension; e.g., .sh or, in your case, .ksh (although that's overkill). An executable shell program does not need nor should it particularly have an extension -- the standard in UNIX-based systems is that executable programs, AKA commands and utilities, just do not have an extension. The idea is that you develop source code, saving source code files with a given extension and then create the executable with the make utility; e.g., if you have a file, prog.sh and type make prog the make utility will copy prog.sh to prog then change mode of prog to 755 with the command chmod 755 prog. Then you can simply type prog on the command line and hit the carriage return and prog will execute. If you look around the system, you will find that there are a large number of shell programs that you use constantly without even realizing that the utilities you're using are just... well, shell programs. You can see this by, for example Code:
file /usr/bin/* | grep -i shell Now, after all that, you can turn your welcome.ksh into an executable program with Code:
cp welcome.ksh welcome And, last but not least, when you write a Korn shell program, be sure and make the first line of the file be Code:
#!/bin/ksh |
All times are GMT -5. The time now is 10:35 AM. |