Quoting conventions (was: Re: How to show a script without comments?)
Joel Roth
joelz at pobox.com
Mon Aug 1 20:19:42 UTC 2016
Joel Roth wrote:
> Okay, this does work. Elegant, don't you think?
>
> cat test.txt | perl -nlE 's/#[^'"'"'"]*$//g; say unless /^\s*$/'
'"'"' is not the only way to express a single quote in bash.
echo ''\'''
also prints '
People criticize perl for being hard to read, but it does
have several quoting conventions that help avoid these weird bashisms.
say q(') # prints '
Cheers,
--
Joel Roth
More information about the ubuntu-users
mailing list