LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Must include full path to symbolic link command (https://www.linuxquestions.org/questions/linux-newbie-8/must-include-full-path-to-symbolic-link-command-4175579537/)

XicKy 05-11-2016 01:53 PM

Must include full path to symbolic link command
 
Hi. I'm trying to set up a vagrant box for laravel framework. I downloaded homestead. The homestead command is a symbolic link and I put it in my path in /etc/environment. But I can only run the command successfully if I provide the full path to it on the command line. Even if I cd into the directory and try to run it there I get "command not found". Any ideas?

grail 05-11-2016 02:15 PM

Is it in your PATH? try:
Code:

echo $PATH
and check to see if the path to your link is there?

When you say you cannot run it from the directory, please show how you are trying to run it?

XicKy 05-11-2016 02:31 PM

Quote:

Originally Posted by grail (Post 5543943)
Is it in your PATH? try:
Code:

echo $PATH
and check to see if the path to your link is there?

When you say you cannot run it from the directory, please show how you are trying to run it?

This is my path when i echo $PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$HOME/.composer/vendor/bin"

if I do:
$ cd ~/.composer/vendor/bin
$ homestead

I get 'command not found'

if I do:
$ ~/.composer/vendor/bin/homestead

then it runs.


the link with ls -alF looks like: homestead -> ../laravel/homestead/homestead*

grail 05-11-2016 02:44 PM

ok, so we have 2 problems:

1. Just like when you run the command using the full path, when you run it from the directory yuo are in you need to tell it where it is:
Code:

$ cd ~/.composer/vendor/bin
$ ./homestead

The '.' means this directory, so it is a relative path instead of an absolute one

2. Your PATH variable should have all other variables expanded, so $HOME should not appear when you echo it. I would suggest you have set the PATH variable something like:
Code:

PATH=$PATH:'$HOME/.composer/vendor/bin'
And the single quotes are preventing the expansion. Try using double quotes around the entire string:
Code:

PATH="$PATH:$HOME/.composer/vendor/bin"

XicKy 05-11-2016 03:01 PM

Quote:

Originally Posted by grail (Post 5543956)
ok, so we have 2 problems:

1. Just like when you run the command using the full path, when you run it from the directory yuo are in you need to tell it where it is:
Code:

$ cd ~/.composer/vendor/bin
$ ./homestead

The '.' means this directory, so it is a relative path instead of an absolute one

DOH!

Quote:


2. Your PATH variable should have all other variables expanded, so $HOME should not appear when you echo it. I would suggest you have set the PATH variable something like:
Code:

PATH=$PATH:'$HOME/.composer/vendor/bin'
And the single quotes are preventing the expansion. Try using double quotes around the entire string:
Code:

PATH="$PATH:$HOME/.composer/vendor/bin"

I had edited /etc/environment. I changed the entry in that file to the absolute path, no variables or ~/ and it works now.

Thanks!


All times are GMT -5. The time now is 06:36 PM.