Skip to content
Laurent SchneiderOracle Certified Master

return code before grep

  • Post author By Laurent Schneider
  • Post date February 10, 2025
  • Categories In Uncategorized

my 2009 solution return code before grep

( 
  ( 
    (
      mycmd
      echo $? >&3
    ) |grep mytext >&4 
  ) 3>&1 |(read x;exit $x) 
)4>&1

my 2025 solution

mycmd > >(grep mytext)
  • Tags UNIX
© 2025  Laurent Schneider Privacy Policy