bug-bash
[Top][All Lists]
Advanced

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

Re: bash doesn't display user-typed characters; can interfere with COPY/


From: Greg Wooledge
Subject: Re: bash doesn't display user-typed characters; can interfere with COPY/PASTE
Date: Tue, 8 Dec 2020 07:55:07 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Mon, Dec 07, 2020 at 05:02:35PM -0800, L A Walsh wrote:
> If I type in (<TAB> + <ENTER> are keypresses)
> 
> if [[ '<TAB>' == $'\t' ]]; then echo ok; else echo notok; fi <ENTER>
> 
> bash displays:
> 
> if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi
> ok

Bash doesn't "display" things.  Your terminal displays that.

> if I now copy the 'if' line and paste it
> 
> if [[ ' ' == $'\t' ]]; then echo ok; else echo notok; fi
> notok

Some terminals, when fed a tab character, will preserve that knowledge
in memory; then, when you copy text from that part of the terminal
window using your mouse, the terminal will put a tab byte into the
selection/clipboard.

Other terminals, when fed a tab character, will just dump out a bunch
of spaces, and will not remember that there was originally a tab character
as part of their input.  Then, if you copy that part of the text, you'll
just get a bunch of spaces instead of the original tab character.



reply via email to

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