Re: combine xargs with EOF

2012-10-17 Thread DJ Mills
On Wed, Oct 17, 2012 at 2:56 PM, wrote: > so this is my actual gol: > > change this loop ( which is working fine ) > > for file in /weldgfs/p51/gius_urban/pop_urban/tl_2010_us_uac10/UA_tiff/*.tif > ; do > filename=`basename $file .tif` > tile=${filename:3:6} > echo processin $file >

Re: combine xargs with EOF

2012-10-17 Thread giuseppe . amatulli
so this is my actual gol: change this loop ( which is working fine ) for file in /weldgfs/p51/gius_urban/pop_urban/tl_2010_us_uac10/UA_tiff/*.tif ; do filename=`basename $file .tif` tile=${filename:3:6} echo processin $file oft-stat $file /weldgfs/p51/gius_urban/LandCover/tre

Re: combine xargs with EOF

2012-10-17 Thread DJ Mills
On Wed, Oct 17, 2012 at 1:52 PM, wrote: > > Sorry i was not clear, > > yes my purpose is > > " simply to avoid having a second file containing a bash script " > but > > find . -maxdepth 1 -name '*.txt' -print0 | xargs -n 1 -P 10 bash -c 'echo > "$1" ' > > or > > ls '*.txt' | xargs -n 1 -P 1

Re: combine xargs with EOF

2012-10-17 Thread Greg Wooledge
On Wed, Oct 17, 2012 at 10:52:37AM -0700, giuseppe.amatu...@gmail.com wrote: > find . -maxdepth 1 -name '*.txt' -print0 | xargs -n 1 -P 10 bash -c 'echo > "$1" ' > do not print $1 so the argument (-n 1) is not passed inside. OK, first thing: you omitted the -0 on xargs. Next, please realiz

Re: combine xargs with EOF

2012-10-17 Thread giuseppe . amatulli
Sorry i was not clear, yes my purpose is " simply to avoid having a second file containing a bash script " but find . -maxdepth 1 -name '*.txt' -print0 | xargs -n 1 -P 10 bash -c 'echo "$1" ' or ls '*.txt' | xargs -n 1 -P 10 bash -c 'echo $1 ' do not print $1 so the argument (-n

Re: combine xargs with EOF

2012-10-17 Thread Greg Wooledge
On Wed, Oct 17, 2012 at 09:49:10AM -0700, giuseppe.amatu...@gmail.com wrote: > ls *.txt | xargs -n 1 -P 10 bash myscript.sh This has some serious flaws already. ls may mangle the filenames that it is feeding to xargs. Any filenames that have spaces or quotes in them will be bungled by xargs its

Re: combine xargs with EOF

2012-10-17 Thread DJ Mills
On Wed, Oct 17, 2012 at 12:49 PM, wrote: > Hi > i'm using often xargs to run process in parallel > > ls *.txt | xargs -n 1 -P 10 bash myscript.sh > > where myscript.sh is (for examples of course is longer): > echo $1 > > i would like to perform the same operation using the EOF syntax and import

combine xargs with EOF

2012-10-17 Thread giuseppe . amatulli
Hi i'm using often xargs to run process in parallel ls *.txt | xargs -n 1 -P 10 bash myscript.sh where myscript.sh is (for examples of course is longer): echo $1 i would like to perform the same operation using the EOF syntax and import the arguments inside the eof I tried ls *.txt | xargs

Re: Regular expression matching fails with string RE

2012-10-17 Thread Greg Wooledge
On Tue, Oct 16, 2012 at 02:18:40PM -0700, car...@taltos.org wrote: > if [[ "foo1" =~ ".*([0-9])" ]]; then As others have said, you must NOT quote the regular expression on the right-hand side of the =~ operator. If you quote it, it becomes a plain string, overriding the =~ operator entirely. The

Re: Clarification needed on signal spec EXIT

2012-10-17 Thread Francis Moreau
On Tue, Oct 16, 2012 at 10:00 PM, Bob Proulx wrote: > Francis Moreau wrote: >> -- >> main_cleanup () { echo main cleanup; } >> submain_cleanup () { echo sub cleanup; } >> >> trap main_cleanup EXIT >> >> task_in_background () { >> echo "subshell $BASHPID" >> >> while :;