bug-bash
[Top][All Lists]
Advanced

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

Re: $"\t': Bash bug or not?


From: Greg Wooledge
Subject: Re: $"\t': Bash bug or not?
Date: Wed, 15 Nov 2017 11:06:46 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Wed, Nov 15, 2017 at 09:01:52AM -0600, Rick Richardson wrote:
> $ echo "$'\t' " | xod
> 
> Dump: standard input
> 
> Offset:    0  1  2  3  4  5  6  7   8  9  a  b  c  d  e  f   0123456789abcdef
> 
> 00000000: 24 27 5c 74 27 20 0a                             | $'\t' .          
> |
> 
> A Bash bug???

No.  You're inside double quotes, so you parse the content accordingly.
Inside double quotes, $ may begin a parameter expansion, or an
arithmetic expansion, and so on.  But in this case, it does not.
So the $ is just taken literally.

If you want to use something that expands to a tab inside double quotes,
try this:

tab=$'\t'
echo "$tab " | xod
echo "${tab}indented" | xod



reply via email to

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