Shell loop bug?

Sascha Hauer s.hauer at pengutronix.de
Tue Nov 17 02:41:22 PST 2015


On Tue, Nov 17, 2015 at 01:24:11PM +0300, Alexander Shiyan wrote:
> Hello.
> 
> barebox@/ # for i in /dev/* ; do echo $i; done
> /dev/flash0
> /dev/full
> /dev/m25p0
> /dev/m25p1
> /dev/mem
> /dev/null
> /dev/ram0
> /dev/self0
> /dev/serial1
> /dev/zero
> 
> barebox@/ # for i in /dev/*1 ; do echo $i; done
> /dev/m25p1
> /dev/serial1
> 
> barebox@/ # for i in /dev/*2 ; do echo $i; done
> /dev/*2
>      ^^^^^^^^ Is this correct?

When there is no /dev/*2, then yes, this is correct.

Try the same under bash, it behaves the same. If there's nothing
matching the wildcard pattern then the wildcards are just passed
through.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list