$PATH

6 replies [Last post]
jakreiling
User offline. Last seen 4 years 36 weeks ago. Offline
Joined: 08/28/2012

I am using Ubuntu installed with virtualbox on a PC. When I type the line defined on page 87 into the .bashrc file to add my scripts folder to the recognized paths and restart the terminal window the scripts folder is the only one it recognizes. It eliminates the original paths, this makes commands like nano and ls not work anymore. I was able to change the file back in a text editor. I typed the command at the end of the file - it was the last line. Does anyone know where I should insert the line to make it function properly? Thanks!

gihannagaye
User offline. Last seen 3 years 39 weeks ago. Offline
Joined: 07/25/2013
.bashrc

Hi. I followed the instructions on p.87 but when i reopened terminal this is what was displayed:

bash: /home/mmee-ubuntu/.bashrc: line 1: syntax error near unexpected token `('
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\0 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircoalias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\''xport PATH/$HOME/scriptsnletion ]; thenmpletiontion ]; then/profile

pcfb
User offline. Last seen 6 days 6 hours ago. Offline
Joined: 08/04/2010
Editing PATH on Debian

Your PATH statement seems to be totally garbled and embedded into the pre-existing commands of the .bashrc file. Is that a copy-paste of the actual output you see?

Why is it inside the square brackets, etc?

Most of that is just statements to define a fancy prompt. You should be OK renaming that to a new file name (mv ~/.bashrc ~/bashrc_mod) or commenting out those lines (put # at beginning of the lines) or deleting those lines in the editor. Then create a new .bashrc that ONLY contains the commands on page 87.
If you would rather try again to define it again using the existing .bashrc instead of a blank file (because other statements are embedded), then add the statements to the end of the file on their own fresh lines, nowhere near the other statements.

tapariayogesh
User offline. Last seen 35 weeks 4 days ago. Offline
Joined: 08/28/2016
Appending Pg 87 statement to .bashrc works perfectly

Appending Pg 87 statement to .bashrc works perfectly!

jakreiling
User offline. Last seen 4 years 36 weeks ago. Offline
Joined: 08/28/2012
I found something that works.

I found something that works. If you type at the end of the file::

PATH=$PATH:/$HOME/scripts
export PATH

This seems to work as /home/jill/scripts shows up at the end of the list when I type echo $PATH. Notice I didn't use the quotes or the brackets around HOME. I found this on a linux troubleshooting site. I tried the same command with the brackets as suggested in the book and got //home/jill/scripts at the end of the list. I'm not sure if the double slash is necessary. I didn't write or run any scripts yet, so I can't be sure it will actually work. I'll update once I get through that part of the book.

As for the typos - I have yet to find a way to copy text from the terminal window running in Linux and paste to a program running in Windows, which is where all the rest of my programs reside. If anyone knows how to do this please let me know....

jakreiling
User offline. Last seen 4 years 36 weeks ago. Offline
Joined: 08/28/2012
$PATH

Hello,

I typed:
export PATH="$PATH:${HOME}/scripts"

When I type echo $HOME is says: home/jill

echo $PATH gives: /usr/lib/lightdm/lightdm:/usr/local.sbin:usr/local/bin:/usr/sbin;/usr/bin:/sbin:/bin:/usr/games

After I enter the line above echo $PATH only says: home/jill/scripts

Strangely echo works but then nano and ls do not, I haven't tried other commands.

Thanks.

pcfb
User offline. Last seen 6 days 6 hours ago. Offline
Joined: 08/04/2010
PATH issues

Is there really a semicolon in your pre-existing PATH definition?
Also local.sbin and not local/sbin?
And no slash before home/jill?
It is impt to copy/paste the exact lines for debugging and not re-type, since tiny errors can make a big difference...

Let me test some things...