I changed my âHOMEâ variable and now cannot find â~/.bash_profileâ to change it back
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I was messing around with environment variables on my Mac, trying to learn how to use them and I used the command nano ~/.bash_profile
where I then added the line HOME=/Users/MyCompName/Desktop
to update my home variable.
This change worked and can be seen when I use printenv
to view all environment variables but when I went to change HOME
back I couldn't seem to find ~/.bash_profile
anymore. Where did it go?
bash mac environment-variables
add a comment |Â
up vote
1
down vote
favorite
I was messing around with environment variables on my Mac, trying to learn how to use them and I used the command nano ~/.bash_profile
where I then added the line HOME=/Users/MyCompName/Desktop
to update my home variable.
This change worked and can be seen when I use printenv
to view all environment variables but when I went to change HOME
back I couldn't seem to find ~/.bash_profile
anymore. Where did it go?
bash mac environment-variables
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I was messing around with environment variables on my Mac, trying to learn how to use them and I used the command nano ~/.bash_profile
where I then added the line HOME=/Users/MyCompName/Desktop
to update my home variable.
This change worked and can be seen when I use printenv
to view all environment variables but when I went to change HOME
back I couldn't seem to find ~/.bash_profile
anymore. Where did it go?
bash mac environment-variables
I was messing around with environment variables on my Mac, trying to learn how to use them and I used the command nano ~/.bash_profile
where I then added the line HOME=/Users/MyCompName/Desktop
to update my home variable.
This change worked and can be seen when I use printenv
to view all environment variables but when I went to change HOME
back I couldn't seem to find ~/.bash_profile
anymore. Where did it go?
bash mac environment-variables
bash mac environment-variables
asked 24 mins ago
Matt
13518
13518
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
It's in the same place.
Before the change ~
expands to something like /Users/YourUserName
, the shell finds your .bash_profile
there. After the file gets sourced ~
expands to another path so ~/.bash_profile
no longer points to the relevant file.
To revert, you need to specify the full path to the file. Try
nano /Users/YourUserName/.bash_profile
Modifying your HOME
variable without changing your actual home directory is not the best idea. Changing any user's home directory is an administrative task, usually regular users cannot do this.
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
@Matt.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use. file
(.
is specified by POSIX) orsource file
(source
is a non-POSIX extension understood by few shells).
â Kamil Maciorowski
1 min ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
It's in the same place.
Before the change ~
expands to something like /Users/YourUserName
, the shell finds your .bash_profile
there. After the file gets sourced ~
expands to another path so ~/.bash_profile
no longer points to the relevant file.
To revert, you need to specify the full path to the file. Try
nano /Users/YourUserName/.bash_profile
Modifying your HOME
variable without changing your actual home directory is not the best idea. Changing any user's home directory is an administrative task, usually regular users cannot do this.
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
@Matt.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use. file
(.
is specified by POSIX) orsource file
(source
is a non-POSIX extension understood by few shells).
â Kamil Maciorowski
1 min ago
add a comment |Â
up vote
2
down vote
accepted
It's in the same place.
Before the change ~
expands to something like /Users/YourUserName
, the shell finds your .bash_profile
there. After the file gets sourced ~
expands to another path so ~/.bash_profile
no longer points to the relevant file.
To revert, you need to specify the full path to the file. Try
nano /Users/YourUserName/.bash_profile
Modifying your HOME
variable without changing your actual home directory is not the best idea. Changing any user's home directory is an administrative task, usually regular users cannot do this.
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
@Matt.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use. file
(.
is specified by POSIX) orsource file
(source
is a non-POSIX extension understood by few shells).
â Kamil Maciorowski
1 min ago
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
It's in the same place.
Before the change ~
expands to something like /Users/YourUserName
, the shell finds your .bash_profile
there. After the file gets sourced ~
expands to another path so ~/.bash_profile
no longer points to the relevant file.
To revert, you need to specify the full path to the file. Try
nano /Users/YourUserName/.bash_profile
Modifying your HOME
variable without changing your actual home directory is not the best idea. Changing any user's home directory is an administrative task, usually regular users cannot do this.
It's in the same place.
Before the change ~
expands to something like /Users/YourUserName
, the shell finds your .bash_profile
there. After the file gets sourced ~
expands to another path so ~/.bash_profile
no longer points to the relevant file.
To revert, you need to specify the full path to the file. Try
nano /Users/YourUserName/.bash_profile
Modifying your HOME
variable without changing your actual home directory is not the best idea. Changing any user's home directory is an administrative task, usually regular users cannot do this.
answered 12 mins ago
Kamil Maciorowski
21.1k154870
21.1k154870
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
@Matt.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use. file
(.
is specified by POSIX) orsource file
(source
is a non-POSIX extension understood by few shells).
â Kamil Maciorowski
1 min ago
add a comment |Â
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
@Matt.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use. file
(.
is specified by POSIX) orsource file
(source
is a non-POSIX extension understood by few shells).
â Kamil Maciorowski
1 min ago
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
Awesome I was able to find it again thanks! Would you mind elaborating on what you mean by "after the file gets sourced"? I'm unfamiliar with what it means for a file to get sourced
â Matt
6 mins ago
@Matt
.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use . file
(.
is specified by POSIX) or source file
(source
is a non-POSIX extension understood by few shells).â Kamil Maciorowski
1 min ago
@Matt
.bash_profile
has a form of a Bash script. You can run a script or source it. Running means creating a subshell and executing the script line by line there. Sourcing means executing the script in the current shell. Some tasks that are meant to affect the current shell cannot be executed in a subshell; changing a variable for the current shell is one of them. That's why some files are sourced, not executed in a subshell. To manually source a file use . file
(.
is specified by POSIX) or source file
(source
is a non-POSIX extension understood by few shells).â Kamil Maciorowski
1 min ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1364748%2fi-changed-my-home-variable-and-now-cannot-find-bash-profile-to-change-it%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password