Home > OS >  /Shell to solve how to use "${PIPESTATUS [0]}", "bash - c" internal command in t
/Shell to solve how to use "${PIPESTATUS [0]}", "bash - c" internal command in t

Time:12-19

 

#!/bin/bash


The command # 1
Bash - c "ls | grep error | grep yes"

# to print at this time is empty, should be only store the return status of the entire command 1
Echo ${PIPESTATUS [1]}

Solution # : but bash - c must be in the business scenario, how to get "grep error" status code?
  • Related