Why did PATH='$PATH:/Path/to/bin' overwrite my PATH?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












In the command line, I appended a directory to my PATH without exporting it:



$ PATH='$PATH:/home/user/anaconda3/bin'



For some reason this has overwritten the PATH environment variable but I'm not sure why this happened. The PATH above is still a colon separated list of directories like it should be so what's the problem? I usually prepend a new directory to my PATH but this time I tested appending it instead which caused unexpected outcomes.



Now any time I try even the simplest commands like ls I get this error (which I expect) followed by a prompt asking me to install the command I typed:



bash: sed: command not found...



Additionally, since I didn't acually export PATH, the subsequent commands are not supposed to inherit the environment of the above PATH variable so what caused it to happen?.



I know I can open a new terminal window to fix it but I'm interested in knowing why this happened?







share|improve this question





















  • Related: unix.stackexchange.com/q/400447/117549
    – Jeff Schaller
    Jul 11 at 19:28














up vote
0
down vote

favorite












In the command line, I appended a directory to my PATH without exporting it:



$ PATH='$PATH:/home/user/anaconda3/bin'



For some reason this has overwritten the PATH environment variable but I'm not sure why this happened. The PATH above is still a colon separated list of directories like it should be so what's the problem? I usually prepend a new directory to my PATH but this time I tested appending it instead which caused unexpected outcomes.



Now any time I try even the simplest commands like ls I get this error (which I expect) followed by a prompt asking me to install the command I typed:



bash: sed: command not found...



Additionally, since I didn't acually export PATH, the subsequent commands are not supposed to inherit the environment of the above PATH variable so what caused it to happen?.



I know I can open a new terminal window to fix it but I'm interested in knowing why this happened?







share|improve this question





















  • Related: unix.stackexchange.com/q/400447/117549
    – Jeff Schaller
    Jul 11 at 19:28












up vote
0
down vote

favorite









up vote
0
down vote

favorite











In the command line, I appended a directory to my PATH without exporting it:



$ PATH='$PATH:/home/user/anaconda3/bin'



For some reason this has overwritten the PATH environment variable but I'm not sure why this happened. The PATH above is still a colon separated list of directories like it should be so what's the problem? I usually prepend a new directory to my PATH but this time I tested appending it instead which caused unexpected outcomes.



Now any time I try even the simplest commands like ls I get this error (which I expect) followed by a prompt asking me to install the command I typed:



bash: sed: command not found...



Additionally, since I didn't acually export PATH, the subsequent commands are not supposed to inherit the environment of the above PATH variable so what caused it to happen?.



I know I can open a new terminal window to fix it but I'm interested in knowing why this happened?







share|improve this question













In the command line, I appended a directory to my PATH without exporting it:



$ PATH='$PATH:/home/user/anaconda3/bin'



For some reason this has overwritten the PATH environment variable but I'm not sure why this happened. The PATH above is still a colon separated list of directories like it should be so what's the problem? I usually prepend a new directory to my PATH but this time I tested appending it instead which caused unexpected outcomes.



Now any time I try even the simplest commands like ls I get this error (which I expect) followed by a prompt asking me to install the command I typed:



bash: sed: command not found...



Additionally, since I didn't acually export PATH, the subsequent commands are not supposed to inherit the environment of the above PATH variable so what caused it to happen?.



I know I can open a new terminal window to fix it but I'm interested in knowing why this happened?









share|improve this question












share|improve this question




share|improve this question








edited Jul 11 at 17:34
























asked Jul 11 at 17:32









MyWrathAcademia

1369




1369











  • Related: unix.stackexchange.com/q/400447/117549
    – Jeff Schaller
    Jul 11 at 19:28
















  • Related: unix.stackexchange.com/q/400447/117549
    – Jeff Schaller
    Jul 11 at 19:28















Related: unix.stackexchange.com/q/400447/117549
– Jeff Schaller
Jul 11 at 19:28




Related: unix.stackexchange.com/q/400447/117549
– Jeff Schaller
Jul 11 at 19:28










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










Single quotes suppress parameter expansion.



$ foo=42
$ echo '$foo' "$foo"
$foo 42





share|improve this answer





















  • yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
    – MyWrathAcademia
    Jul 11 at 17:56










  • Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
    – MyWrathAcademia
    Jul 11 at 18:03






  • 1




    It applies to all parameter expansion everywhere.
    – Ignacio Vazquez-Abrams
    Jul 11 at 18:06










  • then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
    – MyWrathAcademia
    Jul 11 at 19:08











  • The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
    – jthill
    Jul 11 at 20:32










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454746%2fwhy-did-path-path-path-to-bin-overwrite-my-path%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










Single quotes suppress parameter expansion.



$ foo=42
$ echo '$foo' "$foo"
$foo 42





share|improve this answer





















  • yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
    – MyWrathAcademia
    Jul 11 at 17:56










  • Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
    – MyWrathAcademia
    Jul 11 at 18:03






  • 1




    It applies to all parameter expansion everywhere.
    – Ignacio Vazquez-Abrams
    Jul 11 at 18:06










  • then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
    – MyWrathAcademia
    Jul 11 at 19:08











  • The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
    – jthill
    Jul 11 at 20:32














up vote
4
down vote



accepted










Single quotes suppress parameter expansion.



$ foo=42
$ echo '$foo' "$foo"
$foo 42





share|improve this answer





















  • yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
    – MyWrathAcademia
    Jul 11 at 17:56










  • Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
    – MyWrathAcademia
    Jul 11 at 18:03






  • 1




    It applies to all parameter expansion everywhere.
    – Ignacio Vazquez-Abrams
    Jul 11 at 18:06










  • then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
    – MyWrathAcademia
    Jul 11 at 19:08











  • The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
    – jthill
    Jul 11 at 20:32












up vote
4
down vote



accepted







up vote
4
down vote



accepted






Single quotes suppress parameter expansion.



$ foo=42
$ echo '$foo' "$foo"
$foo 42





share|improve this answer













Single quotes suppress parameter expansion.



$ foo=42
$ echo '$foo' "$foo"
$foo 42






share|improve this answer













share|improve this answer



share|improve this answer











answered Jul 11 at 17:34









Ignacio Vazquez-Abrams

31.9k66680




31.9k66680











  • yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
    – MyWrathAcademia
    Jul 11 at 17:56










  • Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
    – MyWrathAcademia
    Jul 11 at 18:03






  • 1




    It applies to all parameter expansion everywhere.
    – Ignacio Vazquez-Abrams
    Jul 11 at 18:06










  • then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
    – MyWrathAcademia
    Jul 11 at 19:08











  • The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
    – jthill
    Jul 11 at 20:32
















  • yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
    – MyWrathAcademia
    Jul 11 at 17:56










  • Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
    – MyWrathAcademia
    Jul 11 at 18:03






  • 1




    It applies to all parameter expansion everywhere.
    – Ignacio Vazquez-Abrams
    Jul 11 at 18:06










  • then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
    – MyWrathAcademia
    Jul 11 at 19:08











  • The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
    – jthill
    Jul 11 at 20:32















yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
– MyWrathAcademia
Jul 11 at 17:56




yes, that was it. Does this also apply to environment variables defined in scripts like .profile and .bashrc?
– MyWrathAcademia
Jul 11 at 17:56












Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
– MyWrathAcademia
Jul 11 at 18:03




Also using your example $ echo "$foo" '$foo' '"$foo"' "'$foo'" ouputs 42 $foo "$foo" '42'
– MyWrathAcademia
Jul 11 at 18:03




1




1




It applies to all parameter expansion everywhere.
– Ignacio Vazquez-Abrams
Jul 11 at 18:06




It applies to all parameter expansion everywhere.
– Ignacio Vazquez-Abrams
Jul 11 at 18:06












then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
– MyWrathAcademia
Jul 11 at 19:08





then its a good thing I never tried this in .profile or any other environment variable containing files - such a subtle difference yet substantial consequences.
– MyWrathAcademia
Jul 11 at 19:08













The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
– jthill
Jul 11 at 20:32




The choices between those substantially different consequences have to be made so often it's worth offering such convenient, even subtle shorthand for specifying which of the possible outcomes you want this time.
– jthill
Jul 11 at 20:32












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454746%2fwhy-did-path-path-path-to-bin-overwrite-my-path%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?