Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing KornShell script

Tags:

shell

unix

ksh

I can't execute my KornShell (ksh) script without the ksh command. I included #!/bin/ksh in the first line of the script but when I try to execute it by name only, it says no such file or directory. Can someone help me?

like image 328
CuriousGuy Avatar asked May 24 '13 12:05

CuriousGuy


1 Answers

  • make sure that ksh is correctly installed in /bin/ksh

    try which ksh from the command-line.

    consider #! /usr/bin/env ksh for more portability.

  • for executing a script run from the command-line ./script in the directory where script exist.

  • If you want to execut the script from any directory without ./ prefix, you have to add the path to your script to the PATH environment variable, add this line

    export PATH="path_to_your_script":$PATH

    to you ~/.kshrc file.

like image 166
Salah Eddine Taouririt Avatar answered Oct 15 '22 22:10

Salah Eddine Taouririt