LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-18-2012, 10:25 PM   #1
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,458

Rep: Reputation: 85
advanced shell redirection


I have a command vpaste that accepts text from stdin and outputs a link to vpaste.net. So if I wanted to paste some text

echo << EOF | vpaste

bull•~» echo << EOF | vpaste [21:24:12]
pipe heredoc> test
pipe heredoc> 123
pipe heredoc> EOF
No text pasted
bull•~»

I get that error. But the vpaste script does work.

bull•~» echo -e "test\n123" | vpaste [21:24:26]
http://vpaste.net/jdAqs
bull•~»

Is something wrong with my shell piping/redirection?
 
Old 04-18-2012, 10:50 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Have you tried
Code:
vpaste << EOF
test
123
EOF
 
1 members found this post helpful.
Old 04-19-2012, 01:25 AM   #3
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,458

Original Poster
Rep: Reputation: 85
[QUOTE=catkin;4656728]Have you tried.../QUOTE]

Works, thanks! Btw, I know that > is for overwriting and >> is for appending, so how does that apply when the redirection is the other way? And why a << instead of a <? Just curious to learn.


bull•~» vpaste << EOF [0:22:48]
heredoc> test
heredoc> 123
heredoc> EOF
http://vpaste.net/LsqPp
bull•~»
 
Old 04-19-2012, 03:06 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
[QUOTE=fakie_flip;4656816]
Quote:
Originally Posted by catkin View Post
Btw, I know that > is for overwriting and >> is for appending, so how does that apply when the redirection is the other way? And why a << instead of a <?
It's a "here document", reference here (scroll down to 3.6.6).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] advanced output redirection pboo Linux - Enterprise 2 08-18-2011 04:47 PM
IO Redirection in Shell azuretha Programming 2 05-29-2011 11:55 PM
Shell Redirection Delay pymehta Linux - Software 10 07-22-2009 08:31 PM
Shell redirection figo Programming 5 05-28-2009 10:03 AM
I/O redirection in a shell script gladeiator Programming 1 11-27-2003 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration