[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: incorrect character handling
From: |
Lawrence Velázquez |
Subject: |
Re: incorrect character handling |
Date: |
Tue, 30 Mar 2021 16:54:55 -0400 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 |
On Tue, Mar 30, 2021, at 4:50 PM, Greg Wooledge wrote:
> On Wed, Mar 31, 2021 at 02:31:46AM +0700, by.sm--- via Bug reports for
> the GNU Bourne Again SHell wrote:
> > poc=whoami
> > $poc
> > python3 -c "print('!!')"
> >
> > That return 'whoami' command.
>
> You're running into the csh-style history expansion. A lot of us simply
> disable it, because it's not worth the effort it takes to work around it.
>
> set +o histexpand
>
>
> If you insist on keeping it, and working around it, the key is to
> understand that single quotes will protect you, but double quotes may
> not.
>
> echo 'hi!'
>
> echo "hi!"
Further reading:
https://mywiki.wooledge.org/BashPitfalls#echo_.22Hello_World.21.22
vq