Bash Scripting Help Needed

Kurt Wall kwall
Mon Oct 18 07:33:29 PDT 2004


On Mon, Oct 18, 2004 at 09:18:18PM +1000, James McDonald took 65 lines to write:
> I have a directory on my Linux box named ~/Admin It contains 2 years of 
> scripts and hacks that I used to manage the windows (sorry for swearing) 
> boxes at my work.
> 
> I am trying to grab all the vbs files under the ~/Admin tree and copy 
> them to a location so that I can sort and categorize them.
> 
> This piece of code gets me a list
> 
> find Admin/ -regex .*vbs$

Try:

find Admin/ -regex .*vbs -print0

See the man page for why you should use -print0

> now when I do some thing like
> 
> for i in `find Admin/ -regex .*vbs$` ; do echo $i ; done

`find Admin -regex .*vbs$` | xargs -null echo

Combining find with -print0 and xargs with -null should handle your spaces
problem.

Kurt
-- 
Immigration is the sincerest form of flattery.
	-- Jack Paar


More information about the Linux-users mailing list