ksh problem

Posted on 2012-08-25
Last Modified: 2012-09-03

When I execute some ksh scripts on a linux server, this error is returned

-ksh: ./expl.ksh: not found [No such file or directory]

How can I resolve this?


Question by:bibi92
    LVL 84

    Expert Comment

    If expl.ksh is not in ./ can you supply the full path?
    LVL 31

    Expert Comment

    Three things:

    First as Ozo suggested, check if it is in your current location by doing
    ls -l expl.ksh

    Second: make sure that file itself is executable
    chmod +x expl.ksh

    Third: make sure you have shebang in the first line of expl.ksh

    Author Comment

    ls -l expl.ksh --> ok -rwxrwxrwx 1 oracle dba 18442 Mar 14 11:01

    I have done chmod +x expl.ksh

    In the first line of expl.ksh : #!/bin/ksh

    But same error when I executed the script.


    LVL 84

    Accepted Solution

    is /bin/ksh the correct path?
    LVL 19

    Expert Comment

    Is the file unix format?If it is DOS format, you'd normally get "Bad interpreter" messages, but your shell version might not display that bit.

    To check, run"od -c expl.ksh" - the text lines displayed should end with a displayed "\n", not with "\r" followed by "\n".

    To convert, the easiest way might be to load it up in vi, enter ":set fileformat=unix", press enter, then save the file with ":wq" and press enter.

    Author Closing Comment

    Thanks, I have created ln -s /bin/ksh /usr/bin/ksh  for resolve my problem. Regards

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Title # Comments Views Activity
    Continuous Ping 10 93
    PowerShell Special Characters In Text String 3 75
    PowerShell Get-Help 10 55
    Unix/bash: scripted arithmetic 13 66
    This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
    Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now