bug-bash
[Top][All Lists]
Advanced

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

Re: echo builtin command will give the wrong value of the variable when


From: Lingfei Kong
Subject: Re: echo builtin command will give the wrong value of the variable when there is a file named: 11 in the current directory
Date: Thu, 28 Jul 2016 09:42:34 +0800

Hi Greg,
Thank you for your detailed explanation, I now understand the reason, and will use quote in my scripts to avoid unexpected bugs.

Best Regards
Lingfei Kong


------------------ Original ------------------
From:  "Greg Wooledge";<wooledg@eeg.ccf.org>;
Date:  Wed, Jul 27, 2016 09:28 PM
To:  "Lingfei Kong"<466701708@qq.com>;
Cc:  "bug-bash"<bug-bash@gnu.org>;
Subject:  Re: echo builtin command will give the wrong value of the variable when there is a file named: 11 in the current directory

On Wed, Jul 27, 2016 at 07:24:11PM +0800, Lingfei Kong wrote:
> # touch 11
> # c='[11761][1469504252]'
> # echo $c               
> 11

This is why you MUST ALWAYS quote your parameter expansions.

echo "$c"

http://mywiki.wooledge.org/Quotes
http://mywiki.wooledge.org/BashGuide

reply via email to

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