In bash I can do the following:
$ printf "foo\nbar\n" | awk '{printf "%s\n", $1}'
foo
bar
… but in zsh when I do the same, I get this:
$ printf "foo\nbar\n" | awk '{printf "%s\n", $1}'
[m\n", printf}'foo
bar
What is it that I am doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you by any chance using oh-my-zsh? there is a bug in the terminal setup that causes it to evaluate %-tags in commands like printf and date (and sub-commands
$()!) due to prompt-expansion in the automatic terminal title setting.Have a look in
~/.oh-my-zsh/termsupport.shand apply this change:(Corresponding omz-issue https://github.com/robbyrussell/oh-my-zsh/issues/890)