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 Wed, 2006-03-01 at 16:38 -0500, Michael Wiktowy wrote:
> Greetings all,
> 
> I have done a fair amount of experimentation and Googling trying to
> find an answer to this and was wondering if some of the bash-scripting
> gurus out there could give me a hand.
> 
> I am trying to make a script that will accept a wildcard to match a
> bunch of files and iterate over those absolute filenames; running the
> command once per filename. It is fairly straight-forward to do so when
> the filesnames don't have spaces but I haven't been able to find the
> magic combination that doesn't treat every space as a list separator. 
> The closest I have gotten is to use the following script:
> 
> #!/bin/bash
> find $* -print0 | xargs -0 -I % command_to_iterate_over %

Try "[email protected]" instead of $*

Paul.



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

  Powered by Linux