Echo eof to file bash




















Ask Question. Asked 11 years, 9 months ago. Active 1 month ago. Viewed 1. I needed to write a script to enter multi-line input to a program psql. And is there a man page for it? Improve this question. Benjamin W. That's probably a useless use of cat. Try psql See also "here strings". I'm surprised it works with cat but not with echo. Works with cat but not with echo. Strange behaviour. Any clue about that? In fact a file name read as a parameter is not a stdin stream.

Alex echo just prints it's command line arguments while cat reads stding when piped to it or reads a file that corresponds to it's command line args — The-null-Pointer-. Add a comment. Active Oldest Votes. Improve this answer. Vojtech Vitek Vojtech Vitek 21k 4 4 gold badges 30 30 silver badges 34 34 bronze badges. Example 1 can be done with a simple multi-line string — Daniel Alder. Like e. From man bash : Here Documents This type of redirection instructs the shell to read input from the current source until a line containing only word with no trailing blanks is seen.

Viewed 37 times. Improve this question. If you are able to figure out how to get echo to display the literal quotes, I suspect this will not solve your actual problem, since your comment "files names that literally have double quotes in the path to deal with special character issues" is rather meaningless.

If your pathnames have literal double quotes, then those double quotes would be considered special characters and accessing the files with such a name would require that they be handled. What are you actually trying to do? Add a comment. Active Oldest Votes. Improve this answer. More than "interprets the quotes": the shell removes the quotes, so that it's impossible to know that they were even there. Part of 3. Viewed 27k times. Improve this question. Add a comment.

Active Oldest Votes. Improve this answer. So what. An int with the value of -1 or if we consider the unsigned version can't possibly be a character anyway since characters can only have a value from 0 to inclusive.

Because I do things like look at the fgetc 3 man page. Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search. I have a httpd. Could anyone tell what is exact way to append simple text file by echo a variable having multiple lines. I used "" quotes but it worked for a single line , and not for multiple lines.

May be what approach i am using is totally wrong. My main concern is to extract all lines of virtual host block related to given sites in shared httpd server and trnsfer it to remote vps's httpd conf file. It seems so that you try to write some characters that are treated by like special characters.

You must escape them with ''. If you want just add lines line1 , line2 , line3 seprated with newlines try. Thank you for additional information. That is a command substitution here, but must be a normal interpolated string.



0コメント

  • 1000 / 1000