Frage

I spent some time on customizing my configuration like many people do. Basically I symlink all my dotfiles (.zshrc, .vimrc,...) from a git repository then I changed a lot of stuff.

I'm on Mac OS X and my configuration works very well. However when I use the same dotfiles on Linux (Ubuntu) I get some differences. Most of them are minor differences but on is VERY annoying.

I use ZSH and prezto

When I do cd I get this message

20:17 ~ ❯ cd Projects                                                                                            

script: invalid option -- 'G'

Usage:
 script [options] [file]

Options:
 -a, --append            append the output
 -c, --command <command> run command rather than interactive shell
 -r, --return            return exit code of the child process
 -f, --flush             run flush after each write
     --force             use output file even when it is a link
 -q, --quiet             be quiet
 -t, --timing[=<file>]   output timing data to stderr (or to FILE)
 -V, --version           output version information and exit
 -h, --help              display this help and exit

The type command (type cd) give me

    cd is an alias for nocorrect cd
    cd is a shell builtin

I am posting here to know if anyone know a way to debug this kind of error. The error message isn't very clear and I don't know what and where to look for.

Any ideas ?

Most of my configuration comes from many other people's configuration.

War es hilfreich?

Lösung 2

Generally, you can start zsh with the parameter -x for debugging. This will echo any line of shell code run by this shell before it is executed. This helps locating where in your configuration things go awry.


In this case you get an error message from script because it does not have an option 'G' in addition to a lists of all available options (try and compare script -G). Command line tools often differ quite a bit between different Unix derivatives, that includes number and meaning of command line options. Compare man script between your platforms.

As cd is an alias for nocorrect cd, nocorrect seems to be the most likely culprit. To check, run unalias cd. If the problem goes away, do a type nocorrect and go from there.

If the problem persists search your configuration for chpwd (this may be either a function definition or a line like add-zsh-hook chpwd SOMETHING).

Andere Tipps

Solution for Ubuntu:

find the script where this code line is located script -q /dev/null ls -G . and change it to script -q /dev/null -c 'ls -G .'

In my case it was prompt_paulmillr_setup, but it depends on which ZSH extension you use.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top