[Buildroot] Bash string manipulation in Kconfig

Yann E. MORIN yann.morin.1998 at free.fr
Mon Sep 3 20:07:47 UTC 2012


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 at 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

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list