Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I read the use of here document. I tried something like this:

echo $* <<End  
anto  
End

What I'm trying here is, when I run this script rather than taking input from command line, I'm asking it to take it as anto. But this doesn't working for me.

I'm very new to bash scripting. Can anyone say, where I'm making the mistake?

Thanks in advance.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

echo doesn't read any information from stdin so you can't use a here-doc with it.

Use cat instead, like

cat<<End
anro
End
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.