rupa / z

z - jump around
Do What The F*ck You Want To Public License
16.33k stars 1.17k forks source link

I get a syntax error every time I try to run the command #196

Open nikitavoloboev opened 7 years ago

nikitavoloboev commented 7 years ago

It outputs this line whenever I try to run something :

/Users/nikivi/.dotfiles/bin/internets/z: line 60: syntax error near unexpected token `<'
/Users/nikivi/.dotfiles/bin/internets/z: line 60: `        awk < <(_z_dirs 2>/dev/null) -v path="$*" -v now="$(date +%s)" -F"|" '

I tried to look at the script itself to see how I can fix this error but I couldn't find what exactly I need to change. Here is how line 60 looks for me : awk < <(_z_dirs 2>/dev/null) -v path="$*" -v now="$(date +%s)" -F"|"

Thank you for any help.

curt-mitch commented 7 years ago

@nikitavoloboev I had the same issue and was able to fix it this way with a clean install:

  1. add this to your .bash_profile: . ~/path/to/your/z/folder/z.sh

  2. Clone this repo into wherever you chose to install it: git clone https://github.com/rupa/z.git

  3. Make the file executable: chmod +x ~/path/to/your/z/folder/z.sh

I figured these out from this tutorial: Setting Up a Mac Dev Machine From Zero to Hero With Dotfiles

I hope this helps!

jonathanrauch commented 7 years ago

@nikitavoloboev I had the same issue and the previously mentioned fix didn't help me, but this did so I'll document it here:

My shell was sh while it needs to be bash for this to work. To change it:

  1. Run the chsh command
  2. Edit the line containing Shell: /bin/sh and change it to: Shell: /bin/bash. Save, restart the terminal.

This fixed the issue.

rupa commented 7 years ago

probably some different things going on here, FWIW:

thundernixon commented 6 years ago

I'm also getting this syntax error with each new z shell window. :/

Curt's solution isn't working, and I don't think Jonathan's makes sense because I know that z should work in zshell.

/Users/stephennixon/devtools/z.sh: line 63: syntax error near unexpected token `<'
/Users/stephennixon/devtools/z.sh: line 63: `        awk < <(_z_dirs 2>/dev/null) -v path="$*" -v now="$(date +%s)" -F"|" ''
jurrianlammerts commented 6 years ago

+1

ericbn commented 6 years ago

@rupa, there's still a process substitution at https://github.com/rupa/z/blob/ea5ec7834398ee2244de26953b3d1ef785d3f942/z.sh#L137 that could affect other shells as reported here.

justinmk3 commented 3 weeks ago

This may be related to shopt. Compare the output of shopt in a shell where this issue occurs, then run bash -i and try again in that shell.