Nvm: awk: syntax error at source line 1

Created on 16 Aug 2015  路  4Comments  路  Source: nvm-sh/nvm

I just checkout a fresh version of nvm from the repo (manual install). and every time I open the shell (zsh) I get the following error:

Last login: Sun Aug 16 20:15:42 on ttys009
awk: syntax error at source line 1
 context is
    { command >>>  printf <<< ("%d%06d%06d\n", $1,$2,$3); }
awk: illegal statement at source line 1
awk: syntax error at source line 1
 context is
    { command >>>  printf <<< ("%d%06d%06d\n", $1,$2,$3); }
awk: illegal statement at source line 1
awk: syntax error at source line 1
 context is
    { command >>>  printf <<< ("%d%06d%06d\n", $1,$2,$3); }
awk: illegal statement at source line 1
awk: syntax error at source line 1
 context is
    { command >>>  printf <<< ("%d%06d%06d\n", $1,$2,$3); }
awk: illegal statement at source line 1

I tracked it down and it seems connected to this:

https://github.com/creationix/nvm/blob/master/nvm.sh#L320

Then I noticed I had to checkout the latest release. When I reverted to v0.26.0 and everything worked as normal.

Not sure if this counts as a bug or not.

bugs shell alias clobbering zsh

Most helpful comment

I got same errors because I had accidentally installed old awk version from brew, because formula was renamed from awk to gawk

$ brew info awk
homebrew/dupes/awk: stable 20121220
Text processing scripting language
http://www.cs.princeton.edu/~bwk/btl.mirror/
Conflicts with: gawk
/usr/local/Cellar/awk/20121220 (4 files, 164K) *
  Built from source
From: https://github.com/Homebrew/homebrew-dupes/blob/master/awk.rb

had to brew remove awk & brew install gawk

All 4 comments

Thanks, while I typically recommend people stick with released versions, this is definitely a bug in unreleased code.

The line here https://github.com/creationix/nvm/commit/58ffa407c2bcd03649d4f62504a5a4235a312657#diff-e1e8e036966ad5aaf7709712cd5d8ee3R320 adds command before printf - I do this in a few other places and haven't had any bug reports in zsh, nor do tests fail :-/ I'll look into it.

Thanks for the report!

thanks for fixing it ;)

I got same errors because I had accidentally installed old awk version from brew, because formula was renamed from awk to gawk

$ brew info awk
homebrew/dupes/awk: stable 20121220
Text processing scripting language
http://www.cs.princeton.edu/~bwk/btl.mirror/
Conflicts with: gawk
/usr/local/Cellar/awk/20121220 (4 files, 164K) *
  Built from source
From: https://github.com/Homebrew/homebrew-dupes/blob/master/awk.rb

had to brew remove awk & brew install gawk

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kunepro picture Kunepro  路  5Comments

goalidea picture goalidea  路  3Comments

tongxiaofeng picture tongxiaofeng  路  5Comments

reneruiz picture reneruiz  路  4Comments

markedcahinde picture markedcahinde  路  5Comments