Hot answers tagged

3

The chsh command only lets you change your login shell from a shell that's listed in /etc/shells, to a shell that's listed in /etc/shells. This is a security and safety feature: if an account has a restricted shell (not listed in /etc/shells), they can't upgrade their access by switching to another shell; and a user can't lock themselves out by switching to ...


2

I have this alias alias sudo='sudo 'defined in a file which I sourced at the end of ~/.zshrc file which overwrote alias sudo='nocorrect sudo' which is defined in .oh-my-zsh/lib/correction.zsh alias sudo='nocorrect sudo' is required by zsh's auto-completion feature to work More: How to disable autocorrection for sudo [command] in zsh? But at same time I ...


2

You need to use p flag to make other expansion flags (follow p) recognize the escape sequence: $ printf '%s\n' ${(ps:\0:)VAR} 5 0 7 or using the shorthand: printf '%s\n' ${(0)VAR} To preserve empty elements: printf '%s\n' "${(0@)VAR}" but you can't use that for output from find ... -print0, because it added trailing \0 to output, you will always ...


2

Homebrew provides it's own completion. You just need to link the file $(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh to _brew somewhere in your $fpath.(See comment at the start of https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh) zsh-completions recently removed its _brew completion in favour of ...


1

The glob~filter (and-not) operator applies a filter as a negative pattern matching on the result of the whole glob. That allows things like: grep foo ./**/*~*/.svn/*(.mh-1) for instance. Here, you'd need: echo tdir/*~tdir/xx Or: echo tdir/*~*/xx Or: echo tdir/(*~xx) Or use the ^ negation operator instead: echo tdir/^xx


1

watch is not an internal command: $ type watch /usr/bin/watch so make sure it installed on the system where you are running zsh.


1

When a command is not found, zsh invokes the function command_not_found_handler. A typical use for this function is to suggest a way to install the command, if it's part of a package that's part of your distribution but isn't installed. In zsh, if the function returns a nonzero status, zsh prints its usual error message. Bash has a similar feature (there ...



Only top voted, non community-wiki answers of a minimum length are eligible