Combining CLI
# cat redirect_example
#!/usr/bin/ksh
cat <<- ATC | sed "s/^/Redirect Example => /g" >> atc.out
This is an example of how to redirect
stdout to a file as well as pipe stdout into stdin
of another command (i.e. sed), all done inside
a here-document.
Cool eh?
ATC
Now let's see what the script looks like with the redirection and pipeline.
# ./redirect_example
# cat atc.out
Redirect Example => This is an example of how to redirect
Redirect Example => stdout to a file as well as pipe stdout into stdin
Redirect Example => of another command (i.e. sed), all done inside
Redirect Example => a here-document.
Redirect Example =>
Redirect Example => Cool eh?
Read more
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.