First page Back Continue Last page Summary Graphic

Cat, Echo and Redirection II

  • Echo is used to display/direct strings.
  • Cat is used to display/direct streams.
  • e.g.
  • a=1
  • b=hello
  • c="$b there $a"
  • echo $c
  • --> hello there 1
  • cat <<TAG
  • $c
  • TAG
  • --> hello there 1
  • echo "hello there 2" >myfile
  • echo "hello there 3" >>myfile
  • cat myfile
  • --> hello there 2
  • --> hello there 3
  • cat nonexistentfile
  • --> cat: nonexistenfile: No such file or directory
  • cat nonexistentfile 2>/dev/null

    Notes: