I want to add a script directory in my home directory (for something different then just adding to bin). I keep getting "No such file or directory" after updating. Now I noticed that in the GUI file manager in the "Home" directory it looks like what I see in the terminal under /home/tony/ (tony is my log in). I am doing everything in the terminal but that is confusing so as an aside can someone explain that discrepancy?

So in my terminal I run ls and I can see the subdirectory "scripts" and I can run the scripts in the directory manually.

I can move there and run pwd and I get /home/tony/scripts

so in my .bashrc file I added at the very bottom many different attempts and I always "get" the update however the directory is never found. As in my path gets updated and when I $echo it back it give the error message and of course my scripts do not run.

I have for example right now

PATH=$PATH:/home/tony/scripts
export PATH

And then whether I "source" it again or open a new terminal I always get "No such file or directory"

it prints out the change I make every time and I have tried all sorts of combinations (i.e. $PATH:$HOME/scripts ...) and no matter what I do it finds no directory.

edit:

Based on the first response I commented out the changes in my .bashrc and I am still getting the error for something basic in my path from the install.

So this is my current path when I log in that was set up by the install... I really have not done much yet to this install at all.

tony@tony-GT70-MSI:~$ $echo $PATH
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: No such file or directory

posted my .bashrc here... http://paste.ubuntu.com/8562344/ LOL and the last two are commented while I am trying to work this out... but when uncommented they show in the path.

  • Can you post your .bashrc to paste.ubuntu.com and edit your question to add a link to it? – muru Oct 14 '14 at 23:45
  • Try running echo $PATH instead. The $ in front of echo is causing the error. – camconn Oct 14 '14 at 23:51
  • @camconn YES removing the $ did remove the bogus error message I was focusing on. – user1054210 Oct 15 '14 at 2:28

I looks like you forgot a trailing slash /. Try this instead:

export PATH=$PATH:/home/tony/scripts/
  • nope that didn't work. I tried probably 30 different variations or more. I spent probably 45 min trying all sorts of things before posting here. – user1054210 Oct 14 '14 at 23:34
  • @user1054210 How are you running your scripts? Are the scripts executable (chmod +x your_script_name.sh)? You should be able to run a script with just script.sh from your home. – camconn Oct 14 '14 at 23:38
  • yes as I explained in the original post the scripts are running normally if I manually type in the path or run from the working directory. The path updates when I change the .bashrc so far as I can tell by echoing the path back out but they do not run unless I type in the full path. – user1054210 Oct 14 '14 at 23:47
  • I updated the question. I think the error message I was focusing on is for something else that may be allowing the path to update but still not work...? – user1054210 Oct 14 '14 at 23:48
  • @user1054210 Can you please post the results of ls -l and pwd of your scripts directory and the output of echo $PATH? – camconn Oct 14 '14 at 23:53

Based on your pasted .bashrc and ls -l output, once the PATH lines are uncommented again, you should be able to run your test script.

Try uncommenting those lines and then:

. ~/.bashrc
test.scr
  • 2
    Sometimes you just need to sleep it off. I figured out my error and it was in the execution. I was still adding the ./ before the script after having adding the path to the script into PATH. Once it is in the PATH variable you don't need to designate the path to it and especially call it "here" when it is "there"... I just needed some coffee. I used to be real good at Unix and a VI master in the '90s but it has been nearly 15 years since I sat down and worked in this type of enviro seriously. – user1054210 Oct 15 '14 at 15:53
  • @user1054210 That should definitely be an answer, not a comment. I'll upvote if noone else will ;) – BalinKingOfMoria Jun 17 '16 at 16:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.