[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: Lawrence Velázquez
Subject: Re: Bash not escaping escape sequences in directory names
Date: Fri, 21 Jan 2022 01:43:57 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4585-ga9d9773056-fm-20220113.001-ga9d97730

On Tue, Jan 18, 2022, at 9:13 PM, Josh Harcombe wrote:
> If a folder that is being displayed as part of the PS1 prompt contains
> escape sequences, bash will interpret them literally instead of escaping
> them like zsh does for example. Escape sequences should be fine if directly
> part of the prompt string and I'm not aware of any way for this to cause
> issues other than messing with the prompt string in potentially unexpected
> ways.

Depends what you consider to be an issue.  Personally, I would be
less than pleased if my whole terminal turned red just because I
changed into a directory that happened to have a weird name.

    % PS1='\w \$ ' bash
    /tmp $ dir=$'\e[31m\e[41m\e[2J'
    /tmp $ mkdir "$dir"
    /tmp $ cd "$dir"          # lol


reply via email to

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