Spaceship-prompt: parse error near `&&'

Created on 29 Aug 2017  路  17Comments  路  Source: denysdovhan/spaceship-prompt

Issue

Got error message when login to console

/home/vagrant/.oh-my-zsh/custom/themes/spaceship.zsh-theme:329: parse error near `&&'

Screenshot

default

Environment

Operating system: Linux Ubuntu 14.04 VM
Terminal emulator: Xshell 5
ZSH version: 5.05

Relevant .zshrc

ZSH_THEME="spaceship"
proposal wontfix

Most helpful comment

It seems there is no official backport for ZSH newer version for Ubuntu 14.04.

All 17 comments

idem:
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-24-generic x86_64)
zsh --version
zsh 5.0.2 (x86_64-pc-linux-gnu)

Same issue on Bash for Windows (Ubuntu 14.04.5)
ZSH 5.0.5

@fascox zsh 5.0.2 isn't supported (see the badges at the top of the README).


@ilyador I don't see that issue on zsh 5.0.5, but technically 5.0.5 shouldn't be supported either (see issue #190). You're probably encountering a different issue. Have you ruled out the rest of your zshrc config?

I upgraded Ubuntu from 14 to 16 (on WSL) and thus upgraded ZSH to 5.1 so now the issue is gone

I've only used spaceship a couple times on 5.0.5. It's definitely possible this is an edge case I didn't hit, which may indicate another reason this is incompatible with 5.0.5.

Same issue on RHEL 6.7 (Santiago)
ZSH 5.4.2 (x86_64-unknown-linux-gnu)

Can anyone share the relevant log produced by setopt xtrace?

Thanks for that, I found the issue:

+/home/thompsons/.oh-my-zsh/oh-my-zsh.sh:9> fpath=( /home/thompsons/.oh-my-zsh/functions /home/thompsons/.oh-my-zsh/completions /home/thompsons/.oh-my-zsh/plugins/git /home/thompsons/.oh-my-zsh/functions /home/thompsons/.oh-my-zsh/completions /usr/share/zsh/site-functions /usr/share/zsh/4.3.11/functions )

My zsh installed in a different location, and is 5.4.2, but the zsh that's called by oh-my-zsh is the default that came with my distro, which is 4.3.11 (which obviously isn't supported).

edit: That directory doesn't even exist...

Occurring to me as well in Trusty, zsh 5.0.5

Same issue here Yosemite 10.10.1, zsh 5.0.5 or zsh 5.4.2 occurs the issue. Another mac on sierra 10.12.3 same zsh configs works fine. Any solutions?

@cheesepaulo what does echo $ZSH_VERSION tell you?

On 5.0.5, I see problems with these lines:

https://github.com/denysdovhan/spaceship-zsh-theme/blob/68068b61e5e8852dcdfff1f19a796758f86d2cde/spaceship.zsh#L337

and

https://github.com/denysdovhan/spaceship-zsh-theme/blob/68068b61e5e8852dcdfff1f19a796758f86d2cde/spaceship.zsh#L803

Both of these lines can be resolved by replacing [[ $foo ]] with [[ -n $foo ]]. I'm pretty sure this is a dupe of zsh-users/zsh-syntax-highlighting#225 (it uses the solution I've described). #121 had the same root cause too.

It sounds like this only appears for old versions of zsh (the borderline is somewhere between 5.0.5 and 5.1)


We can add the fix I mentioned, but spaceship still won't work properly on 5.0.5 (until #190 is resolved)

Thanks @nfischer I solve this upgrading my zsh.

Mac has a native zsh 5.0.5 and brew install 5.4.2 BUT not always change the 5.4.2 as a default zsh. You need to override this behavior to works fine!

If you have Homebrew installed, you can do this.

check the zsh info

brew info zsh

install zsh

brew install --without-etcdir zsh

add shell path

sudo vim /etc/shells

add the following line into the very end of the file(/etc/shells)

/usr/local/bin/zsh

change default shell

chsh -s /usr/local/bin/zsh

I'm having the same issue (though line 337) with up to date zsh on Mac OS X 10.10.5

~/.oh-my-zsh/custom/themes/spaceship.zsh-theme:337: parse error near `&&'
$ zsh --version
zsh 5.4.2 (x86_64-apple-darwin14.5.0)

Solved via @nfischer 's suggestion

It seems there is no official backport for ZSH newer version for Ubuntu 14.04.

As it mentioned before, you should upgrade to zsh higher than v5.0.5.

@salmanulfarzy again, we need to upgrade our requirements for zsh in badge and requirements section.

We already have zsh>=5.0.5 in our README, We should update it to something not less than 5.2 as a safety measure (Which is already 2 year old release).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JounQin picture JounQin  路  3Comments

martincartledge picture martincartledge  路  4Comments

oldchevy picture oldchevy  路  3Comments

nfischer picture nfischer  路  3Comments

tbekaert picture tbekaert  路  3Comments