LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to run a symbolic link as a script (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-a-symbolic-link-as-a-script-900206/)

rytec 08-30-2011 03:02 AM

How to run a symbolic link as a script
 
I have created a symbolic link with the command ln -s /etc/xmltv/ftpchannels.sh channels.sh
Then I changed the symlink channels.sh with chmod 755 but when I type in the commandline channels.sh it gives me the message channels.sh: command not found
The symlink @channels.sh is in my root directory.

Or do I need to put the #bin/bash! line in top of the original script? till now I always have run the script as /etc/xmltv/ftpchannels.sh and it works.

Where am I going wrong?

acid_kewpie 08-30-2011 03:12 AM

don't mess with the symlink, the permissions of the destination file are what matter. if you can run the script directly then a symlink to it should work just the same way. It sounds here that you've just got a path issue, run "./channels.sh" then I bet it'll work. your current directory should *never* be on your path, so unless you explicitly state you want to run something in the current directory, it won't find it.

rytec 08-30-2011 03:26 AM

./channels.sh did the trick.

Thank you

grail 08-30-2011 03:30 AM

I would add that the command you submitted, chmod 755, will in fact act on what the link is pointing to and not the link itself.


All times are GMT -5. The time now is 12:59 PM.