The wording of your question is ambiguous, so I can't tell if you mean you want to stop using zsh
or you want to stop using oh-my-zsh
. I will cover both.
Disabling zsh
Simply run chsh
and select whatever shell you were using before. If you don't know what shell you were using before, it is almost certainly bash
. This command changes the "login shell" that is associated with your user. Essentially, it changes your default shell.
You will need to open a new terminal window for changes to take effect. If this does not work, you will need to log out and log back in again to reinitialize your environment.
Disabling only oh-my-zsh
- Check if
~/.zshrc.pre-oh-my-zsh
exists. It probably does. (This file will have been created when the oh-my-zsh
installation script moved your previous .zshrc
out of the way. .zshrc
is a startup file of zsh
, similar to .bashrc
for bash
.)
- If it does, do
mv ~/.zshrc ~/.zshrc.oh-my-zsh
. This will put the oh-my-zsh
-created .zshrc
out of the way, so we can restore the original, by doing mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc
.
- If it does not exist, open
~/.zshrc
in a text editor. Find the line that says source $ZSH/.oh-my-zsh
and either comment it out or remove it. This will disable the initialization of oh-my-zsh
.
You will need to restart your shell for changes to take effect.
You can disable the PATTERN(QUALIFIERS)
syntax by unsetting the bare_glob_qual
option:
setopt no_bare_glob_qual
If the option extended_glob
is set (and you should set it, the only reason not to set it is for backward compatibility with rare scripts that use unusual syntax), then there is another syntax for glob qualifiers: PATTERN(#qQUALIFIERS)
. So you can still use glob qualifiers, which are one of zsh's killer features, but you'll have to type a bit more.
Zsh lets you disable wildcard expansion (globbing) altogether, and this looks like a better choice for you. If a command is prefixed by noglob
, then no globbing is performed on its arguments. For example, to be able to type URLs containing ?
as arguments to wget
, I have alias wget='noglob wget'
. If you set alias ag='noglob ag'
, you can type ag mymethod(param)
.
If ag
takes both a search pattern and file names as arguments, then disabling globbing is not good. If you're able to parse the arguments of ag
, then you can perform wildcard expansion on them. I don't know the syntax of ag
, so I'll give an example where I assume that ag
only takes options that don't take arguments, and that its first non-option argument is a pattern and the rest are files.
ag () {
local i=1
while [[ ${(P)i} = -* ]]; do ((++i)); done
if ((i < $#)); then
set -- "${(@)@[1,$i]}" $~@[$((i+1)),$#]
fi
}
alias ag='noglob ag'
Best Answer
This is one of Zsh's parameter expansions here applied to
$*
:See Gilles' typically thorough answer to What is word splitting? Why is it important in shell programming for context.
Normally,
zsh
doesn't do word splitting by default, so presumably, that's to make sure$*
is not split even when theSH_WORD_SPLIT
option has been enabled one way or another (for instance via aemulate sh
).However, in most cases, you'd rather want to use
"$@"
(note the quotes which are important here) instead of$==*
.$==*
(like$*
whenSH_WORD_SPLIT
is off) expands only to the non-empty positional parameters, while"$@"
expands to all the positional parameters (regardless ofSH_WORD_SPLIT
, and that works in all Bourne-like shells).