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