On 16 Mar 2003, Kleiner Hampel wrote:
> Hi,
>
> tricky!
>
> But what is about:
>
> ${var##string}
> ${var%string}
> ${var%%string}
>
> What means the double #, the single and double #?
> Please explain me in some words! Thanks!
> Is there a man page with this information?
these are internal *shell* constructs, so you would find
them in the man page for "bash".
respectively, they are operators which will *remove*, and return
to you what's left, after removing from the variable value:
1) the shortest prefix matching the pattern
2) the longest prefix matching the pattern
3) the shortest suffix matching the pattern
4) the longest prefix matching the pattern
example:
$ filename=/a/b/c/fred.c
$ echo ${filename%.c}
/a/b/c/fred
$ echo ${filename##*/}
fred.c
... and so on. and they're blindingly fast since they're built
into the shell.
rday
p.s. i just typed in the above from memory -- here's hoping there's
no typoes, but i'll let you play with them.
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list