Re: Difficulties with PS1.

2024-02-08 Thread Greg Wooledge
On Thu, Feb 08, 2024 at 02:17:54PM +0700, Dmitry wrote:
> Greetings!
> 
> 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.

Most likely, you're setting PS1 in .bashrc or /etc/bash.bashrc and you
didn't use the --norc option to suppress it.



Re: Difficulties with PS1.

2024-02-07 Thread Dmitry

PS1="Works $PS1" bash --noprofile --norc
https://stackoverflow.com/questions/9357464/how-to-start-a-shell-without-any-user-configuration



Re: Difficulties with PS1.

2024-02-07 Thread Michael Kjörling
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?”



Difficulties with PS1.

2024-02-07 Thread Dmitry

Greetings!

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"

Is not this syntax:
VAR="..." VAR1="..." command

Set an environment variables?

Thank you!