# cf. http://www.linuxjournal.com/article/7385 (comments) function shcat() { if [[ $# -eq 0 ]]; then while read -r -d $'\n'; do printf "%s\n" "${REPLY}"; done else for F in "$@"; do while read -r -d $'\n'; do printf "%s\n" "${REPLY}"; done < "$F" done fi return 0 } echo hello world | shcat shcat file.txt | nl
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
cat as a script (See related posts)
You need to create an account or log in to post comments to this site.
Related Posts
» Notifications from shell scr... in shell osx mac bash script unix gui notification
» Record terminal sessions wit... in shell osx mac bash script unix terminal session record ttyrec
» more as a script in more shell osx mac bash script unix less
» ws - web search from the com... in shell osx mac search bash unix commandline web
» snippet in shell osx mac html bash unix commandline web download convert textutil ed snippet
» Switching firewall settings ... in shell osx mac bash unix ipfw firewall ruleset switch
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails