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
On 11 Apr 2008, at 10:19, Hans-Joerg Bibiko wrote:
[...] I tried to get rid of escaping a backslash in bash [...]
Fine. BUT THIS ONLY WORKS UNDER LEOPARD!
Under Tiger I have to write this: [...] 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.]
In my experience bash variable substitution is buggy or at least very limited. As you noticed, backslashes will give problems, but so will quotes and regular slashes (escaped).
I have not been able to find any documentation about which rules apply to the search and replace string (not even sure I have read anywhere that the search string is kind of a glob, but it seems to be iirc).