You are not logged in.

#1 2018-06-28 10:42:40

Scriptor
Member
Registered: 2011-01-16
Posts: 146

[SOLVED]Bash cd in directory with whitespace

Hello,

I recently noticed a strange behaviour when cd into a directory with white spaces, for example dir 1. Then, even though I successfully changed into that directory, I get this message at the end of EVERY command I call :

expr: syntax error: unexpected argument '1'

I never got this problem before.

Kernel version: 4.17.2
zsh version: 5.5.1

Thank you very much in advance.

Last edited by Scriptor (2018-06-28 13:10:33)

Offline

#2 2018-06-28 11:18:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: [SOLVED]Bash cd in directory with whitespace

I'd suspect a problem with your PS1 or PROMPT_COMMAND (or other ZSH equivalents).

Set these all to empty, or simple characters - if that resolves the issue, post your configs.

Are you using oh-my-zsh, by chance?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2018-06-28 13:04:27

Scriptor
Member
Registered: 2011-01-16
Posts: 146

Re: [SOLVED]Bash cd in directory with whitespace

Thank you for your reply.

So I set PS1 and PROMP_COMMAND to empty and it, indeed, solved the problem.

I am using antigen.

Here is my config:

# source antigen
source ~/.antigen/antigen.zsh

# use oh-my-zsh
antigen use oh-my-zsh

# plugins
antigen bundle archlinux
antigen bundle mvn
antigen bundle extract

# external plugins
antigen bundle https://github.com/zsh-users/zsh-autosuggestions

# themes
antigen theme https://github.com/denysdovhan/spaceship-prompt spaceship

# done
antigen apply

Thank you very much in advance.

[edit]
I finally understood where the problem lies, thanks to this issue on github

Since I am using spaceship as my prompt theme, I had to set SPACESHIP_DIR_TRUNC_REPO to false, and it seems to work.
[/edit]

Last edited by Scriptor (2018-06-28 13:10:22)

Offline

Board footer

Powered by FluxBB