On Thu, May 19, 2022 at 06:24:21PM +0100, Tixy wrote: > On Thu, 2022-05-19 at 07:00 -0400, Greg Wooledge wrote: > > 1) For ** to work, you need to do "shopt -s globstar" somewhere before it. > > I didn't know that, it works for me without setting that option. > > $ shopt | grep globstar > globstar off > $ echo /sys/bus/usb/drivers/usb/**/serial > /sys/bus/usb/drivers/usb/usb1/serial > /sys/bus/usb/drivers/usb/usb2/serial > /sys/bus/usb/drivers/usb/usb3/serial > /sys/bus/usb/drivers/usb/usb4/serial
You're getting the exact same results you'd get from /sys/bus/usb/drivers/usb/*/serial unicorn:~$ bash unicorn:~$ mkdir -p /tmp/x/y/z/foo.txt unicorn:~$ echo /tmp/**/*.txt /tmp/dumps/greg_log.txt unicorn:~$ shopt -s globstar unicorn:~$ echo /tmp/**/*.txt /tmp/dumps/greg_log.txt /tmp/x/y/z/foo.txt With globstar on, ** and * become different.