I have a simple command line:
uptime | awk '{print $(NF - 2)}'
In a bash shell, this works without a hitch, but when I run it in zsh, I get the following error:
title:5: command not found: NF
As usual this will be a pilot error (me not grokking how expansion works in zsh), but I cannot figure out what to do to get the same command to work in zsh.
[Edit]
The zsh version is 4.3.11 on OSX, and the output from set -xv; uptime | awk '{print $(NF - 2)}' is:
$ set -xv; uptime | awk '{print $(NF - 2)}'
title:5: command not found: NF
+zsh:3> uptime
+zsh:3> awk '{print $(NF - 2)}'
0.51
+precmd:1> title '%15<..<%~%<<' '%n@%m: %~'
+title:1> [ '' '!=' true ']'
+title:2> [[ xterm-256color == screen* ]]
+title:4> [[ xterm-256color == xterm* ]]
+title:5> print -Pn '\e]2;%n@%m:\ %~\a'
+title:6> print -Pn '\e]1;%15\<..\<%~%\<\<\a'
+zsh:4> git_prompt_info
+git_prompt_info:1> ref=+git_prompt_info:1> ref=''
+git_prompt_info:1> return
+zsh:4> vi_mode_prompt_info
+vi_mode_prompt_info:1> echo ''
So apparently the awk command works, but my terminal customization is borked.
set -xv; uptime | awk '{print $(NF - 2)}'$( ... )is interpreted by the shell (as command substitution). I suppose that when you quote the dollar sign\$( ... )the code will run fine.zsh -fand re-run the pipeline? It seems there is a problem with your rc file.