Bash string manipulation in Kconfig
Hello everyone.
What is the equivalent buildroot thing for handling the following bash string stuff ?
FULL_DOWNLOAD_URL="http://www.somedomain.com/blah/blah2/blahblahblah/somefile" FILE=${FULL_DOWNLOAD_URL##*/}
echo ${FILE}
That will correctly print only the last part of the url, "somefile"
But how to do similar in buildroot .mk files ???
Best regards
Stefan
Le Mon, 03 Sep 2012 21:56:31 +0300,
Stefan Fr?berg <[email protected]> a ?crit :
Quoted 1 line
But how to do similar in buildroot .mk files ???
$(notdir $(FOO))
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
3.9.2012 22:08, Thomas Petazzoni kirjoitti:
Quoted 7 lines
Le Mon, 03 Sep 2012 21:56:31 +0300,
Stefan Fr?berg <[email protected]> a ?crit :Quoted 1 line
But how to do similar in buildroot .mk files ???
$(notdir $(FOO))Thomas
Thanks Thomas!
That was fast :)
Stefan
3.9.2012 22:08, Thomas Petazzoni kirjoitti:
Quoted 7 lines
Le Mon, 03 Sep 2012 21:56:31 +0300,
Stefan Fr?berg <[email protected]> a ?crit :Quoted 1 line
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
Stefan
Le Mon, 03 Sep 2012 22:53:52 +0300,
Stefan Fr?berg <[email protected]> a ?crit :
Quoted 2 lines
for i in $(FULL_DOWNLOAD_URL);do \
echo $(notdir $$i) ; \Inside this for loop, what you're writing is shell code, not make code.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
3.9.2012 23:01, Thomas Petazzoni kirjoitti:
Quoted 8 lines
Le Mon, 03 Sep 2012 22:53:52 +0300,
Stefan Fr?berg <[email protected]> a ?crit :Quoted 2 lines
for i in $(FULL_DOWNLOAD_URL);do \ echo $(notdir $$i) ; \Inside this for loop, what you're writing is shell code, not make code.
Thomas
And because that notdir is buildroot make construct I can't use it inside for-loop ?
Can you suggest another way to extract file part from variable that contains bunch of URL's in for-loop ?
Stefan
Stefan, All,
Quoted 22 lines · On Monday 03 September 2012 21:53:52 Stefan Fr?berg wrote:
3.9.2012 22:08, Thomas Petazzoni kirjoitti:
Quoted 7 lines
Le Mon, 03 Sep 2012 21:56:31 +0300,
Stefan Fr?berg <[email protected]> a ?crit :Quoted 1 line
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:
Quoted 7 lines
somefile1
somefile2But 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
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
3.9.2012 23:07, Yann E. MORIN kirjoitti:
Quoted 34 lines
Stefan, All,
Quoted 21 lines · On Monday 03 September 2012 21:53:52 Stefan Fr?berg wrote:
3.9.2012 22:08, Thomas Petazzoni kirjoitti:
Quoted 7 lines
Le Mon, 03 Sep 2012 21:56:31 +0300,
Stefan Fr?berg <[email protected]> a ?crit :Quoted 1 line
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:
Quoted 7 lines
somefile1
somefile2But it prints instead:
http://www.somedomain.com/blah/blah/somefile1
http://www.somedomain2.com/blah2/blah2/blah/somefile2That's because $(notdir ...) is onterpreted by make, while $i is interpreted by the shell.
Quoted 8 lines
In your case, you'd want to use the shell constrcut:
for i in $(FULL_DOWNLOAD_URL);do \ echo $${i##*/} ; \done
Regards,
Yann E. MORIN.
Ah... I see
Thanks Yann!
And Thanks Thomas!
These shell-make mixing is so confusing ....
Stefan
Quoted 31 lines · Yann E. MORIN
Stefan, All,
Quoted 21 lines · On Monday 03 September 2012 21:53:52 Stefan Fr?berg wrote:
3.9.2012 22:08, Thomas Petazzoni kirjoitti:
Quoted 7 lines
Le Mon, 03 Sep 2012 21:56:31 +0300,
Stefan Fr?berg<[email protected]> a ?crit :Quoted 1 line
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:
Quoted 7 lines
somefile1
somefile2But it prints instead:
http://www.somedomain.com/blah/blah/somefile1
http://www.somedomain2.com/blah2/blah2/blah/somefile2
Quoted 8 lines
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
Signature · 6 lines
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