List Archive: gentoo-amd64
On Wed, 16 Sep 2009 21:36:37 +0800
Xi Shen <davidshen84@...> wrote:
> when reading that doc, i cannot understand the following script
>
> #!/bin/bash
> exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-g${0:$[-2]} "$@"
>
> what does the ":" do here?
>
>
The construction "${0:$[-2]}" will return the last two characters of
the $0 string, with the $0 string being the name of the called script.
These last two characters are appended to the string "sparc-unknown-linux-gnu-g".
After glancing at the section in cross-compiling-distcc.xml, it seems
that this particular script will be called via a symlink, which will
be one of gcc, g++, c++. The last two chars of the link name are thus
appended to "sparc-unknown-linux-gnu-g" to form the name of an execuatable,
e.g. /usr/lib/distcc/bin/sparc-unknown-linux-gnu-gcc.
Frank Peters
|
|