hello,
I have following form of input from command:
I have a script which already does what I want - returning asd_status=all300 in case all asd[0-9]*=300, and returingng asd_status="with_list_of_not_300":
could we rid of /tmp/testfile and get the expected result just piping this sample input: echo "asd1=$1\nasd2=$2\nasd3=$3\nasd4=$4\nasd5=$5" | .... ? (eg. awking it)?
I have following form of input from command:
Code:
asd1=300
asd2=300
asd3=200
asd4=400
asd5=300
I have a script which already does what I want - returning asd_status=all300 in case all asd[0-9]*=300, and returingng asd_status="with_list_of_not_300":
Code:
# cat ./test_
echo "asd1=$1\nasd2=$2\nasd3=$3\nasd4=$4\nasd5=$5" > /tmp/testfile
if grep -vq \=300$ /tmp/testfile
then
echo asd_status=$(grep -v \=300$ /tmp/testfile|tr '\n' ','|sed s/\,$//g)
else
echo asd_status=all300
fi
# ./test_ 300 200 300 100 300
asd_status=asd2=200,asd4=100
# ./test_ 300 300 300 100 300
asd_status=asd4=100
# ./test_ 300 300 300 300 300
asd_status=all300
could we rid of /tmp/testfile and get the expected result just piping this sample input: echo "asd1=$1\nasd2=$2\nasd3=$3\nasd4=$4\nasd5=$5" | .... ? (eg. awking it)?