This command successfully gives me the clearcase views I want in stdout, one line per view name. Each view name appears to have no spaces.
cleartool lsview | grep -i `uname -n` | grep -v "ViewStorage\\|vgr_tools_sv" | cut -f 3 -d ' '
How can write a cygwin bash "for" loop that will iterate thru these views and call another script for each view?
thanks
siegfried
That's precisely what xargs does. For example, ... | xargs commandname
will run commandname arg1 arg2 arg3 ...
It'll run commandname program with as many arguments as safely possible without exceeding your system's argument limit. If xargs is fed more lines than your system allows arguments, then it will call commandname more than once.
If you want to limit the number of arugments a program is fed -- one argument per call, for example, use the -n option.
cleartool lsview | grep -i `uname -n` | grep -v "ViewStorage\\|vgr_tools_sv" | cut -f 3 -d ' ' | xargs -n 1 myviewer
How do I implement a "for" loop that will call
./build.bat $arg1
./build.bat $arg2
./build.bat $arg3
etc...
cleartool lsview | grep -i `uname -n` | grep -v "ViewStorage\\|vgr_tools_sv" | cut -f 3 -d ' ' | xargs -n 1 ./build.bat
Wow! Thanks. I did not know xargs would work that way.
This works too (I thought of it this morning):
$ for ii in `cleartool lsview | grep -i $(uname -n) | grep -v "ViewStorage\\|vg
r_tools_sv" | cut -f 3 -d ' ' ` ; do echo ; echo $ii; done
I think Corona's is more efficient, however.