On 8 Feb 2024 14:17 +0700, from lbvf50.mob...@gmail.com (Dmitry): > Why variable PS1 dose not change when set it before a command: > Like this: > A="a1" LANG="C.UTF-8" PS1="new" B="b2" bash --noprofile > > $A, $B, $LANG -changed, $PS1 - not. > > Works only when I explicitly set in current process. > > export PS1="(chroot) $PS1"
Your syntax is correct (at least for bash; I don't know about other shells), but it seems likely that $PS1 is being reset by bash's reading of its initialization files. Try with --norc as well. See bash(1) for details. Note that this will likely also have other consequences. -- Michael Kjörling 🔗 https://michael.kjorling.se “Remember when, on the Internet, nobody cared that you were a dog?”