LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   screwed up adding to $PATH--cmds don't work (https://www.linuxquestions.org/questions/linux-newbie-8/screwed-up-adding-to-%24path-cmds-dont-work-567416/)

7stud 07-07-2007 12:41 PM

screwed up adding to $PATH--cmds don't work
 
Hi,

I tried adding to my PATH environment variable in ~/.bash_profile, and I screwed something up, and now no commands, like ls, vi, etc., work anymore. I need to get back into ~/.bash_profile and fix it, but I can't figure out how to open ~/.bash_profile to edit it. I usually edit with vi. I'm on max os 10.4.7.

theNbomr 07-07-2007 12:59 PM

Try doing what the shell does: look for the executable in a specific ordered list. I suggest you start with this list:

/bin/
/usr/bin/
/usr/local/bin/

Try running whatever program you want by prefixing it with one of these directories:

eg. /bin/vi

If you still don't understand how you messed up your bash startup scripts once you've gotten into them, post them here (use [ C O D E ] tags please).

--- rod.

7stud 07-07-2007 01:36 PM

Quote:

Originally Posted by theNbomr
Try doing what the shell does: look for the executable in a specific ordered list. I suggest you start with this list:

/bin/
/usr/bin/
/usr/local/bin/

Try running whatever program you want by prefixing it with one of these directories:

eg. /bin/vi

If you still don't understand how you messed up your bash startup scripts once you've gotten into them, post them here (use [ C O D E ] tags please).

--- rod.

Thanks! /usr/bin/vi ~/.bash_profile worked. I mistyped a character in my .bash_profile file, and that is what was causing me the problems.

I have another question: what's the difference between using $PATH and ${PATH}?

theNbomr 07-07-2007 01:47 PM

Quote:

I have another question: what's the difference between using $PATH and ${PATH}?
Semantically, nothing. The curly braces are used to disambiguate the name of the variable in certain circumstances, such as when a variable needs to be interpolated and concatenated at the same time:

For instance:
Code:

DIR="/bin/"
# can't write $DIRvi...
echo ${DIR}vi

--- rod

7stud 07-07-2007 06:14 PM

Thanks.
,,,
....


All times are GMT -5. The time now is 09:03 AM.