Posted By

oznek on 06/11/10


Tagged

test Bash stdin


Versions (?)

Test stdin data presence in bash


 / Published in: Bash
 

URL: http://stackoverflow.com/questions/2456750/detect-presence-of-stdin-contents-in-bourne-shell

  1. #!/bin/sh
  2. if [ -t 0 ]; then
  3. echo running interactivelly
  4. else
  5. while read -r line ; do
  6. echo $line
  7. done
  8. fi

Report this snippet  

You need to login to post a comment.