[TxMt] Leopard Tiger evil pitfall: escaping a backslash in bash
Hans-Joerg Bibiko
bibiko at eva.mpg.de
Fri Apr 11 08:19:10 UTC 2008
Hi,
During the last two days I've fought against my mind.
I tried to get rid of escaping a backslash in bash. I have a bash
scripts which reads the selection/line, does something, and finally it
returns the result as InsertAsSnippet back to TM. Fine. Among others
one has to escape '\'. OK. I did this in Leopard
T="123\\123"
echo "${T//\\/\\\\}"
Fine. BUT THIS ONLY WORKS UNDER LEOPARD!
Under Tiger I have to write this:
T="123\\123"
echo "${T//\\\\/\\\\}"
It took me two days to figure out that this is caused by using two
different versions of Bash.
Is this a known issue? If so, is there link to an article mentioning
more of them?
[I couldn't find an entry mentioning that macromates.com. Maybe worth
to have one.]
To be compatible with Leopard and Tiger I have to write e.g.:
T="123\\123"
echo "$T" | sed 's/\\/\\\\/'
Regards
--Hans
More information about the textmate
mailing list