Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7195983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:41:20+00:00 2026-05-28T20:41:20+00:00

In bash I can do the following: $ printf foo\nbar\n | awk ‘{printf %s\n,

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:41:22+00:00Added an answer on May 28, 2026 at 8:41 pm

    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.sh and apply this change:

    *** termsupport.zsh.orig    2012-01-31 10:49:57.503119973 +0100
    --- termsupport.zsh 2012-01-31 10:50:55.043118110 +0100
    ***************
    *** 24,31 ****
      function omz_termsupport_preexec {
        emulate -L zsh
        setopt extended_glob
    !   local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
    !   title "$CMD" "%100>...>$2%<<"
      }
    
      autoload -U add-zsh-hook
    --- 24,35 ----
      function omz_termsupport_preexec {
        emulate -L zsh
        setopt extended_glob
    !   local CMD_1=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
    !   local CMD_2=${2//\$\(/\\\$(} # ')}
    !   CMD_1=${CMD_1//\%/%%}          
    !   CMD_2=${CMD_2//\%/%%}          
    !   #
    !   title "${CMD_1}" "%100>...>${CMD_2}%<<"
      }
    
      autoload -U add-zsh-hook
    

    (Corresponding omz-issue https://github.com/robbyrussell/oh-my-zsh/issues/890)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In bash one can escape arguments that contain whitespace. foo a string This also
Can I embed the following bash shell code: for name in $(git diff --name-only
In bash how can I make a construction like this to work: if (cp
In Bash I can create a map (hashtable) with this common construction hput() {
I want to write a sh/bash script that can determine whether a particular directory
Can you use the bash getopts function twice in the same script? I have
In Bash, I can use the following code: [ $sshcmd = ] && sshcmd=ssh
I'm writing a bash script to get some podcasts. The problem is that some
Let's suppose I have a bash script ( foo.sh ) that in a very
How can I translate the following Ruby code to Bash? if ARGV.length == 0

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.