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";<wool...@eeg.ccf.org>;
Date:  Wed, Jul 27, 2016 09:28 PM
To:  "Lingfei Kong"<466701...@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