Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Unable to execute a symbolic link in linux

Posted on 2010-09-11
Medium Priority
Last Modified: 2012-05-10
Running redhat enterprise linux 5. I created a symbolic link to a shell script but when I try to execute the symbolic link I get the message:
bash: ./stopall.sh: No such file or directory

My working directory is the directory containing the symbolic link and I tried executing it with the command:

Is there some other step I need to perform?
Question by:opike
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
LVL 48

Expert Comment

ID: 33655651
What does

ls -l stopall.sh


Expert Comment

ID: 33655767
I dont' think your file is executable.  Either use

  chmod +x stopall.sh

or try

  . stopall.sh

Notice the . with a space after.

Author Comment

ID: 33657091
Here is the output from ls -la (links definitely have execute permission set):

[ollie@oracleepm oraclelinks]$ ls -la
total 12
drwxrwxr-x  2 ollie ollie 4096 Sep 11 17:30 .
drwx------ 23 ollie ollie 4096 Sep 12 08:12 ..
lrwxrwxrwx  1 ollie ollie    8 Sep 11 17:25 startall.sh -> start.sh
lrwxrwxrwx  1 ollie ollie   15 Sep 11 17:30 startEssbase.sh -> startEssbase.sh
lrwxrwxrwx  1 ollie ollie    7 Sep 11 17:25 stopall.sh -> stop.sh
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 48

Accepted Solution

Tintin earned 2000 total points
ID: 33658521
There's your problem, you have a symbolic link pointing to a non-existent file.

Where does stop.sh exist?

You need to do

ln -s  /some/path/to/stop.sh stopall.sh

Expert Comment

ID: 33668462
That does kind of raise an interesting point.  I see that the file is executable, but it is pointing to something that is in the local directory or available through the path variable.  Does "./stop.sh" work?  Does ". stop.sh" work?  And, do the others work, startall.sh and startEssbase.sh?

LVL 48

Expert Comment

ID: 33668803

The symlinks won't work as they point to non-existent files.  Simple as that.

Expert Comment

ID: 33688841
@tintin, just checking all bases.  Seems like an odd question to ask about one particular symlink if none are working.  I just wanted to make sure that none of them are working.  No need to blast me... :-p

Author Closing Comment

ID: 33698545
Mixed up order of arguments...

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.
Suggested Courses

636 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