Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    Here is a Simple test you can try out quickly : [[A]] In level 1 Bash Process : Execute PS1=########## then the Prompt will Change. Now start level 2 bash within the same Bash Process, PS1 will revert back in Level 2 Bash Process. Now, Exit this level 2 Bash Process, going back to Level 1 Bash Process [[B]] Execute export PS1=########## & Start a new Level 2 Bash Process. You will see that PS1 will not revert. In [[A]] , it was not exported, while in [[B]] , it was exported. This will Confirm that it is not exported by Default. Hence it is not Environment Variable by Default. Commented Sep 17, 2022 at 16:09
  • It's an environment variable if it's set as one somewhere. Like you could set PS1 in /etc/environment, and the shell you get at login would read it in from the environment. Though with PS1 in particular, Bash unsets it if running non-interactively, and sets it to a default value when running interactively if it isn't set, so there's often no need to export it in the environment but there might be need to set it in bashrc. But if you don't set it unconditionally in .bashrc, you can do things like PS1='some variant prompt' bash to run another shell with a modified prompt Commented Sep 17, 2022 at 17:29