[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash not escaping escape sequences in directory names

From: Greg Wooledge
Subject: Re: Bash not escaping escape sequences in directory names
Date: Mon, 24 Jan 2022 14:24:08 -0500

On Mon, Jan 24, 2022 at 07:53:03PM +0100, Andreas Kusalananda Kähäri wrote:
> I was honestly a bit surprised to see bash picking up PS1 from the
> environment.  Why would people want it to do that (i.e. export PS1)?

It removes the need for bash to re-set it from .bashrc every time a new
interactive shell is initialized.  Just a personal choice, really.

> The cd and pwd utilities are expected to provide particular output.  A
> system administrator often sets the bash shell's prompt, and having
> the shell output unwanted escape sequences to the terminal through the
> prompt may be somewhat of a surprise to users who do not know or care
> about modifying PS1 in their startup scripts. [...]

I don't have a strong opinion about this issue, but I lean toward the
side of "leave it alone".  The only time it will become an issue is if
a user successfully navigates into a directory with terminal escape
sequences in its name.  This is probably hard to pull off, and if a user
*does* manage it, I think they won't be too shocked by the results.

While I could see such a user coming here to complain about it, the fact
that this hasn't ever happened (at least as far as I'm aware) means this
isn't a realistic problem that needs to be addressed.  It's extremely

reply via email to

[Prev in Thread] Current Thread [Next in Thread]