Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: escaping a colon in a function



zsh-3.0.2> x=addr:0.0.0.0
zsh-3.0.2> echo ${x##addr:}
0.0.0.0

apparently works. No escaping of the colon is necessary at all.

Greetings, Wolfgang.

--
kutek@xxxxxxxxxxxxx wrote:
>  i have read the docs and i have not found therein a way to escape a
>  colon within a function.
>
>  what i am doing is parsing the output of ifconfig to get my currently
>  active ip address.the ouput of that function is in the form
>
>       addr:0.0.0.0
>
>  and i am attempting to use the ${name##pattern} construct to remove the
>  "addr:" from the ultimate output. unfortunately,zsh seems to be interpreting
>  the colon in the pattern as a delimiter and complains that there is no
>  closing brace in the function. i have tried both single and double quotes
>  as well as the backslash to escape the colon's special meaning..to no avail.



Messages sorted by: Reverse Date, Date, Thread, Author