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

Re: weird behaviour of quotes in dash variable assignments




On 2020-09-21 13:12, Greg Wooledge wrote:
On Mon, Sep 21, 2020 at 12:59:32PM -0400, Gary Dale wrote:
Did you try it with Konsole? I got

$ hd
a       b
00000000  61 20 20 20 20 20 20 20  62 0a |a       b.|
0000000a
In other words, konsole *did* alter the contents.

Most shells (all that I am aware of) treat tabs and blanks as generic white
space - not relevant to the execution of the code.
Between arguments, sure.  Tabs and spaces are equivalent in those places.
But inside a quoted string argument?  No, they're not equivalent.

Who knows what other conversions might have taken place?

You were trying to troubleshoot a script that wasn't doing what you
expected.  And yet you just hand-waved everything, rather than getting
in there and doing the work to actually *check* things.

That's where you are making unwarranted assumptions. I tried the line outside of the script, hand entered rather than copied & pasted, and got the same result. There was something weird going on in the dash shell at the time. Just because I didn't report all the testing I'd done doesn't mean you should assume that I didn't do it.



Reply to: