From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] Bash string manipulation in Kconfig
Date: Tue, 04 Sep 2012 07:53:17 +0200 [thread overview]
Message-ID: <5045974D.9010101@mind.be> (raw)
In-Reply-To: <201209032207.47111.yann.morin.1998@free.fr>
On 09/03/12 22:07, Yann E. MORIN wrote:
> Stefan, All,
>
> On Monday 03 September 2012 21:53:52 Stefan Fr?berg wrote:
>> 3.9.2012 22:08, Thomas Petazzoni kirjoitti:
>>> Le Mon, 03 Sep 2012 21:56:31 +0300,
>>> Stefan Fr?berg<stefan.froberg@petroprogram.com> a ?crit :
>>>
>>>> But how to do similar in buildroot .mk files ???
>>> $(notdir $(FOO))
>>>
>>> Thomas
>> One more question:
>>
>> Why does not the following work ?
>>
>> FULL_DOWNLOAD_URL=http://www.somedomain.com/blah/blah/somefile1
>> FULL_DOWNLOAD_URL+=http://www.somedomain2.com/blah2/blah2/blah/somefile2
>>
>> for i in $(FULL_DOWNLOAD_URL);do \
>> echo $(notdir $$i) ; \
>> done
>>
>> I expect it to print:
>>
>> somefile1
>> somefile2
>>
>> But it prints instead:
>>
>> http://www.somedomain.com/blah/blah/somefile1
>> http://www.somedomain2.com/blah2/blah2/blah/somefile2
> That's because $(notdir ...) is onterpreted by make, while $i is
> interpreted by the shell.
>
> In your case, you'd want to use the shell constrcut:
> for i in $(FULL_DOWNLOAD_URL);do \
> echo $${i##*/} ; \
> done
>
Actually, in this case you just want
$(notdir $(FULL_DOWNLOAD_URL))
(the notdir function can take a list of filenames).
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
prev parent reply other threads:[~2012-09-04 5:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 18:56 [Buildroot] Bash string manipulation in Kconfig Stefan Fröberg
2012-09-03 19:08 ` Thomas Petazzoni
2012-09-03 19:13 ` Stefan Fröberg
2012-09-03 19:53 ` Stefan Fröberg
2012-09-03 20:01 ` Thomas Petazzoni
2012-09-03 20:07 ` Stefan Fröberg
2012-09-03 20:07 ` Yann E. MORIN
2012-09-03 20:12 ` Stefan Fröberg
2012-09-04 5:53 ` Arnout Vandecappelle [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5045974D.9010101@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox