
davidshen84 at googlemail
Sep 16, 2009, 6:04 PM
Post #6 of 9
(1173 views)
Permalink
|
i searched for a while, but cannot find the reference of that syntax. thanks a lot. On Thu, Sep 17, 2009 at 12:27 AM, Frank Peters <frank.peters [at] comcast> wrote: > On Wed, 16 Sep 2009 21:36:37 +0800 > Xi Shen <davidshen84 [at] googlemail> 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 > > > -- Best Regards, David Shen http://twitter.com/davidshen84/ http://meme.yahoo.com/davidshen84/
|