Sha256: e2ad94e2cf403f156088101213f54a65108a08eafe6bc10fd4c851d2fdf4e6fe

Contents?: true

Size: 497 Bytes

Versions: 48

Compression:

Stored size: 497 Bytes

Contents

ok() {
   exec 3>&1
   eval `
      exec 4>&1 >&3 3>&-
      {
          eval "$@" 2>&1 >/dev/null
          echo "EC=$?;" >&4
      } | sed 's/^/# /'
      `
   [ "$EC" = 0 ] && echo "ok - $@" || echo "not ok - $@: $EC"
   return $EC
}


# example usage:

 # ok true
 # ok ! false
 # 
 # ok "(ok true | grep -q '^ok')"
 # ok "(ok false | grep -q '^not ok')"
 # 
 # # self-test
 # ok ok true
 # ok ! ok "false"
 # 
 # ok "(ok 'echo foo>/dev/stderr' 2>&1 | grep -q '# foo') # stderr gets commented"

Version data entries

48 entries across 48 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 examples/knock.sh
auser-poolparty-1.3.1 examples/knock.sh
auser-poolparty-1.3.10 examples/knock.sh
auser-poolparty-1.3.11 examples/knock.sh
auser-poolparty-1.3.12 examples/knock.sh
auser-poolparty-1.3.13 examples/knock.sh
auser-poolparty-1.3.14 examples/knock.sh
auser-poolparty-1.3.15 examples/knock.sh
auser-poolparty-1.3.16 examples/knock.sh
auser-poolparty-1.3.17 examples/knock.sh
auser-poolparty-1.3.2 examples/knock.sh
auser-poolparty-1.3.3 examples/knock.sh
auser-poolparty-1.3.4 examples/knock.sh
auser-poolparty-1.3.5 examples/knock.sh
auser-poolparty-1.3.6 examples/knock.sh
auser-poolparty-1.3.7 examples/knock.sh
auser-poolparty-1.3.8 examples/knock.sh
fairchild-poolparty-1.3.17 examples/knock.sh
fairchild-poolparty-1.3.5 examples/knock.sh
poolparty-1.6.9 examples/knock.sh