Re: retval of pipelined cmd in bash

2002-12-20 Thread Randall R Schulz
Elfyn, If you looker more closely, you'll see that Sören already knows about the $? variable. Randall Schulz At 14:51 2002-12-20, Elfyn McBratney wrote: Hello Soren, What you need is the $? variable. The simplest testcase would be this: >>> rt.c int main() { return(21); } <<< [root@webd

Re: retval of pipelined cmd in bash

2002-12-20 Thread Elfyn McBratney
Hello Soren, What you need is the $? variable. The simplest testcase would be this: >>> rt.c int main() { return(21); } <<< [root@webdev]:{509}:% gcc rt.c -o rt [root@webdev]:{510}:% ./rt [root@webdev]:{511}:% echo $? 21 [root@webdev]:{512}:% Elfyn [EMAIL PROTECTED] --- Soren A <

Re: retval of pipelined cmd in bash

2002-12-20 Thread Max Bowsher
Soren A <[EMAIL PROTECTED]> wrote: > Does anyone know how to do this -- how to pull out a return value > from a command in the middle of a pipeline? Bash has a builtin array variable PIPESTATUS. There are also some horrible file descriptor manipulation recipes out there for other shells, if you

Re: retval of pipelined cmd in bash

2002-12-20 Thread Randall R Schulz
Sören, If you wrote all that yourself, I can't say you look like a BASH newbie. Then again, there's that "too clever by half" thing... As an aside, I find "export NAME=value" to be clearer than "declare -x NAME=value", but that's just opinion. As to your problem, first of all, you're only cap

retval of pipelined cmd in bash

2002-12-20 Thread Soren A
Hallo Cygwains, [Heck, I dunno... "Cygwinauts"?]. I have a possibly OT question, that is, a bash shell question. Lacking the insight into the deepest reaches of shell-ology, I have come up empty on all attempts to solve this one for myself. (Those attempts have included doing `info bash' and read