Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.lang.shell.unix.bourne-bash > #214

Trouble with PIPESTATUS

Newsgroups alt.comp.lang.shell.unix.bourne-bash
Date 2015-11-02 10:38 -0800
Message-ID <e0c9e002-beae-4f89-8577-4e8f45f2ea94@googlegroups.com> (permalink)
Subject Trouble with PIPESTATUS
From lynto28@gmail.com

Show all headers | View raw


Greetings,

I'm having trouble getting the PIPESTATUS with the following code:

set -o pipefail
declare -a DIRLIST
DIRLST=$(ls -lda /tmp/foo/* | grep ^d | awk '{print $9}')
echo "0: ${PIPESTATUS[0]} 1: ${PIPESTATUS[1]} 2: ${PIPESTATUS[2]}"
# 
if [ ${PIPESTATUS[0]} -eq 0 ] && [ ${PIPESTATUS[1]} -eq 0 ] && [ ${PIPESTATUS[2]} -eq "0" ]; then
	echo "Direcotry List Good."
else
	echo "Directory List Bad"
fi

Only PIPESATUS[0] is getting set. Any ideas what I'm doing wrong here?

Thanks in advance for any help.

   Tom

Back to alt.comp.lang.shell.unix.bourne-bash | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Trouble with PIPESTATUS lynto28@gmail.com - 2015-11-02 10:38 -0800
  Re: Trouble with PIPESTATUS Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-11-02 21:16 +0000

csiph-web