Rawest raw string literals

Tim Chase python.list at tim.thechases.com
Fri Apr 21 08:12:24 EDT 2017


On 2017-04-21 08:23, Jussi Piitulainen wrote:
> Tim Chase writes:
>> Bash:
>>   cat <<EOT
>>   "single and double" with \ and /
>>   EOT
>>
>> PS: yes, bash's does interpolate strings, so you still need to do
>> escaping within, but the arbitrary-user-specified-delimiter idea
>> still holds.
> 
> If you put any quote characters in the initial EOT, it doesn't.
> Quote removal on the EOT determines the actual EOT at the end.
> 
>   cat <<"EOT"
>   Not expanding any $amount here
>   EOT

Huh, I just tested it and you're 100% right on that.  But I just
re-read over that section of my `man bash` page and don't see
anything that stands out as detailing this.  Is there something I
missed in the docs?

Thanks for this little tip (filing away for future use)

-tkc





More information about the Python-list mailing list