1 |
i searched for a while, but cannot find the reference of that syntax. |
2 |
thanks a lot. |
3 |
|
4 |
|
5 |
On Thu, Sep 17, 2009 at 12:27 AM, Frank Peters <frank.peters@×××××××.net> wrote: |
6 |
> On Wed, 16 Sep 2009 21:36:37 +0800 |
7 |
> Xi Shen <davidshen84@××××××××××.com> wrote: |
8 |
> |
9 |
>> when reading that doc, i cannot understand the following script |
10 |
>> |
11 |
>> #!/bin/bash |
12 |
>> exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-g${0:$[-2]} "$@" |
13 |
>> |
14 |
>> what does the ":" do here? |
15 |
>> |
16 |
>> |
17 |
> |
18 |
> The construction "${0:$[-2]}" will return the last two characters of |
19 |
> the $0 string, with the $0 string being the name of the called script. |
20 |
> These last two characters are appended to the string "sparc-unknown-linux-gnu-g". |
21 |
> |
22 |
> After glancing at the section in cross-compiling-distcc.xml, it seems |
23 |
> that this particular script will be called via a symlink, which will |
24 |
> be one of gcc, g++, c++. The last two chars of the link name are thus |
25 |
> appended to "sparc-unknown-linux-gnu-g" to form the name of an execuatable, |
26 |
> e.g. /usr/lib/distcc/bin/sparc-unknown-linux-gnu-gcc. |
27 |
> |
28 |
> Frank Peters |
29 |
> |
30 |
> |
31 |
> |
32 |
|
33 |
|
34 |
|
35 |
-- |
36 |
Best Regards, |
37 |
David Shen |
38 |
|
39 |
http://twitter.com/davidshen84/ |
40 |
http://meme.yahoo.com/davidshen84/ |