[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: option to continue on exit status 255 (patch incl)
From: |
Brian Dessent |
Subject: |
Re: option to continue on exit status 255 (patch incl) |
Date: |
Thu, 14 Aug 2008 11:42:29 -0700 |
address@hidden wrote:
> address@hidden xargs]seq 5004 5006 | awk '{print "minion"$1}' | xargs -t -i
> ssh -q address@hidden "uname -a"
> ssh -q address@hidden uname -a
> Linux minion5004 2.6.8.1-26mdksmp #1 SMP Mon Nov 28 12:40:04 MST 2005 i686
> Intel(R) Xeon(TM) CPU 2.80GHz unknown GNU/Linux
> ssh -q address@hidden uname -a
> xargs: ssh: exited with status 255; aborting
Can't you achieve the desired effect portably without requiring any
xargs special casing with e.g.
(stuff) | xargs -t -i sh -c 'ssh -q address@hidden "uname -a"; ret=$?; test
$ret == 255 && exit 0; exit $ret'
Or if you don't care what the exit value is,
(stuff) | xargs -t -i sh -c 'ssh -q address@hidden "uname -a" || :'
Although I think I would argue xargs is really not the right tool for
the job here at all -- you're only using it to substitute {} for a
variable, and the shell is more than capable of doing that on its own
(not to mention the needless use of awk):
$ for H in `seq 5004 5006`; do ssh -q address@hidden "uname -a"; done
Also, it sounds like you might want to check out 'dsh'.
Brian