Tag Info

Hot answers tagged

4

If there is no match for *aaa* an error is reported by default. This is what causes your script to exit. To avoid this the NULL_GLOB option has to be set. Then instead of reporting an error the pattern is simply removed from the argument list, if nothing matches. There are several ways to set NULL_GLOB: for the whole script by passing the -G command line ...


3

The Z shell uses /bin/sh if you run an executable script without shebang line (see man zshmisc, section COMMAND EXECUTION or check out this answer for a comprehensive list). This seems hard-coded. So, if you don't want to use the unix-way (add shebang line), you can use a socalled suffix alias in the Z shell to execute all files with a certain extension with ...


2

A likely reason for this behaviour is that you have some settings in your ~/.zshrc that update the terminal title to contain the currently running command line without quoting special characters, like \e. Most likely the line that actually updates the title looks something like that: print -n -- "\e]2; $commandline \a" Instead of \e]2; it may also be ...


2

The command fc -e - should do what you want. This is a little bit tricky, because fc -e [edit-cmd] usually lets you edit tha last command with an editor. But if the [edit-cmd] equals -, no editor is invoked and the command is executed immediately. But you won't need an alias for that, because the command r is already defined in the Z shell: $ which r r: ...


1

unalias supports unsetting multiple aliases at the same time, so you do not have to do this one by one, necessarily. I would suggest just dropping all aliases and reload them anew from ~/.alias. unalias ${(k)aliases} ${(k)galiases} ${(k)saliases}; source This requires the zsh/parameter module to be loaded. Check with zmodload | grep parameter, load with ...


1

You can use a subshell to get rid of the job control messages: $ alias alertme="xmessage Alert!" $ ( alertme & ) $ If your commad also produces some output to STDOUT and/or STDERR, pipe those to /dev/null: $ ( alertme > /dev/null 2>&1 & )


1

Open /etc/passwd: sudo vi /etc/passwd Find the line with your username: username:x:1634231:100:Your Name:/home/username:/bin/bash and replace bash with zsh: username:x:1634231:100:Your Name:/home/username:/bin/zsh Log out and log in back for the changes to take effect.


1

If I get you right, this only occurs, when you use the form rake test .... Then you can use this patch against $fpath/_rake diff --git a/Completion/Unix/Command/_rake b/Completion/Unix/Command/_rake index 7fed949..96ee930 100644 --- a/Completion/Unix/Command/_rake +++ b/Completion/Unix/Command/_rake @@ -37,12 +37,16 @@ case "$state" in ;; target) ...


1

~/.zshrc is zsh's user configuration for interactive shells. (actually it is $ZDOTDIR/.zshrc, but HOME is used if ZDOTDIR is unset) ~/.zshrc-e has no special meaning to zsh and is not used by it. Unless, of course, you load it somewhere in ~/.zshrc. (If I had to guess, I would say it is probably just a backup/copy of ~/.zshrc, but that is easy to check.)


1

Why bother with the alias? I believe it would be fine to just make a short script which sources your script and then calls zsh $@: #!/bin/zsh source my/script/path $@ Then (if you named it libload) it works like this ./libload yourscript -options -options2 You could also just put your code right in the file if that is easier. Also, it should be possible ...



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