On 2016-12-05 12:38, Gluszczak, Glenn wrote: > I can't seem to get sh -c to recognize newline. Tcsh -c works. > I'm using echo as an example but I'm actually trying to build a > here-document. > %%%sh -c "echo \nhello" > nhello > %%%sh -c "echo \\nhello" > nhello > %%%sh -c "echo \\\nhello" > \nhello > %%%tcsh -c "echo \nhello" > nhello > %%%tcsh -c "echo \\nhello" > \nhello > %%%tcsh -c "echo \\\nhello" > hello
Your login shell is scanning and interpreting escapes in the input, then the subshell you are running, so you need to quote \n to let echo see it. Builtin echo does not recognize escapes without -e. You can use echo -e, or $ prefix a single quoted string to have the shell interpret the escape sequence. $ sh -c "echo -e '\nhello'" hello $ sh -c "echo $'\n'hello" hello $ sh -c "echo $'\nhello'" hello -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple