|
What does "cat -" do on the Unix command line?Hello I would like to know the what exactly does cat - mean in Unix? I was recently reading through an article that mentioned this command and couldn't understand what it did. "cat" is the 'concatenate' program and its purpose is to display the contents of one or more file. Add the '-' flag, however, and you have it display the content of "standard input" or "stdin": in a pipe like: tail myfile | cat - It's basically a null operation, since this is no different than doing: tail myfile
A lot of shell script authors use structures like this too: cat - << EOF
for what we script programmers call a here document, but most times this can be accomplished in other ways that are more resource efficient on the system.
In general, the cat - command is sometimes useful for shell scripting, but in general usage you'll rarely, if ever, see it on a command line.
Categorized:
Unix and Linux Help
(Article 4137,
Written by Dave Taylor)
Tagged: Previous: Are there dangers in having high school students blog? Next: How do I subscribe to RSS feeds with Safari? Subscribe!
Note that "cat -" is basically "cat" anyway. Posted by: monsieur at May 17, 2006 5:05 AMhi thanks Posted by: John at January 10, 2008 12:16 AMHow do i subscribe to your website? Posted by: Stephen at May 17, 2009 11:56 PMI have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help WordPress Help |