Re: How to handle passing filenames with spaces and wildcards into bash scripts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 3/1/06, Paul Howarth <[email protected]> wrote:
On Wed, 2006-03-01 at 16:38 -0500, Michael Wiktowy wrote:
> #!/bin/bash
> find $* -print0 | xargs -0 -I % command_to_iterate_over %

Try "[email protected]" instead of $*

Paul.


I knew there was something obvious that I was missing.

The following:
#!/bin/bash
find "[email protected]" -print0 | xargs -0 -I % command_to_iterate_over %

Does exactly what I needed when calling it with unquoted but properly escaped argument like:
./script /path/to/filenames\ with\ spaces* /other/path\ with\ spaces/to\ other\ filenames\ with\ spaces*

It doesn't work with quoted command-line parameters with wildcards in them but that's OK to me. I will have to experiment a bit more with that and put [email protected] in my mental toolbox.

Thank you kindly, Paul and Robert!

/Mike

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux