Gentoo Archives: gentoo-amd64

From: Xi Shen <davidshen84@××××××××××.com>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64]corss compile 64bit on 32bit os
Date: Thu, 17 Sep 2009 10:25:11
Message-Id: 53e35fd50909170325w4ea99561uec6dea2a5a2b1f47@mail.gmail.com
In Reply to: Re: [gentoo-amd64]corss compile 64bit on 32bit os by Frank Peters
1 thanks, very helpful.
2
3
4 On Thu, Sep 17, 2009 at 10:26 AM, Frank Peters <frank.peters@×××××××.net> wrote:
5 > On Thu, 17 Sep 2009 09:04:22 +0800
6 > Xi Shen <davidshen84@××××××××××.com> wrote:
7 >
8 >> i searched for a while, but cannot find the reference of that syntax.
9 >> thanks a lot.
10 >>
11 >
12 > The ordinary syntax is ${string:position:length}, but in the ordinary case
13 > the position is referenced from the LEFT end of the string.  To reference
14 > from the RIGHT end of the string, as in the Gentoo script, a negative value
15 > must be specified, but the negative value has to the result of an EXPRESSION,
16 > hence the apparently unusual syntax.
17 >
18 > Why?  See question E12 at this link:
19 > http://www.faqs.org/faqs/unix-faq/shell/bash/
20 >
21 > Just try it out.  Copy the following two lines to a file, give the file
22 > executable permission, and create different symbolic links to it.
23 > Then invoke the file using any of the symlinks.
24 >
25 > #! /bin/bash
26 > echo ${0:$[-2]}
27 >
28 >
29 > Frank Peters
30 >
31 >
32 >
33
34
35
36 --
37 Best Regards,
38 David Shen
39
40 http://twitter.com/davidshen84/
41 http://meme.yahoo.com/davidshen84/