zsh

Worth switching to zsh for casual use?

The default shell in Mac OS X is bash, which I'm generally happy to be using. I just take it for granted. It would be really nice if it auto-completed more stuff, though, and I've heard good things about zsh in this regard. But I don't really have the inclination to spend hours fiddling with settings to improve my command line usage by a...

Case-insensitive Glob on zsh/bash

I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome. ...

Home/End keys in zsh don't work with putty

I'm running zsh as the default shell on a Ubuntu box, and everything works fine using gnome-terminal (which as far as I know emulates xterm). When I login from a windows box via ssh and putty (which also emulates xterm) suddendly the home/end keys no longer work. I've been able to solve that adding these lines to my zshrc file... bind...

What's in your .zshrc?

I always find it interesting what people put in their programming environments. After reading the same basic question for .vimrc and .bashrc, I have to ask for my favorite shell. So what's in yours? ...

How to add a progress bar to a bash script?

When scripting in bash or any other shell in *NIX, while running a command that will take more than a few seconds, a prgress bar is needed. For example, copying a big file, opening a big tar file. What ways do you recommend to add progress bars to bash scripts? ...

What's the best practice for changing working directories inside scripts?

Do you think changing directories inside bash or Perl scripts is acceptable? Or should one avoid doing this at all costs? What is the best practice for this issue? ...

Getting Emacs ansi-term and Zsh to play nicely

I've been trying to use Zsh within my emacs session, without emacs remapping all the Zsh keys. I found ansi-term works pretty well for this but, I'm still having some problems. I was getting lots of junk characters outputted with, I was able to fix it with: ## Setup proper term information for emacs ansi-term mode [[ $TERM == eterm-colo...

In zsh, how do I pass anonymous arrays into functions?

e.g. looking for something like: foo() { echo ${1[2]} '\n'; } a=(abc def ghi) foo $a --> def Or ideally: foo (abc def ghi) ...

zsh: stop backward-kill-word on directory delimiter

In zsh, how can I set up the line editor such that backward-kill-word stops on a directory separator? Currently in my bash setup, if I type cd ~/devel/sandbox and then hit C-w point will be right after "devel/". In my zsh setup, point would be after "cd ". I'd like to set up zsh so it behaves similarly to bash. ...

How to split on NULs in shell

I am using zsh as a shell. I would like to execute the unix find command and put the result into a shell array variable, something like: FILES=($(find . -name '*.bak')) so that I can iterate over the values with something like for F in "$FILES[@]"; do echo "<<$F>>"; done However, my filenames contain spaces at least, and perhaps o...

Zsh: extract a CGI query to an associative array

I have a CGI query like this: 'a=1&b=2&c=3'. I want to extract it in an associative array A such as $A[a]=1, $A[b]=2 and $[c]=3. I found this way, but I would like to find a simpler (shorter) way to this : QUERY='a=1&b=2&c=3' typeset -a T T=( ${(s:&:)QUERY} ) typeset -A A A=() for v in $T; do A+=( ${(s:=:)v} ) done (bonus: find ...

Zsh tab-completion for "cd .."

How can I configure the Zsh tab-completion such that when I type cd ..<TAB> it expands to cd ../ and after pressing <TAB> again proposes the folders in the parent directory for completion? E.g. it should show the same behavior as when typing for example cd Documents<TAB> which expands to cd Documents/ and after pressing <TAB> again prop...

How does "while (sleep 100 &!) do; done" work in zsh, and how could it be replicated in bash?

According to wikipedia ( http://en.wikipedia.org/wiki/Fork_bomb ), the forkbomb ":(){ :|:& };:" can be stopped with the zsh command "while (sleep 100 &!) do; done", which will supposedly spawn sleep 100 processes until all the forkbomb processes are gone. This seems like magic to me. Can anybody explain why/how this works? I'm especia...

How can I change the color of my prompt in zsh (different from normal text)?

To recognize better the start and the end of output on a commandline, I want to change the color of my prompt, so that it is visibly different from the programs output. As I use zsh, can anyone give me a hint? ...

How can you export your .bashrc to .zshrc?

I am trying to move to zsh from Bash. I put my .bashrc directly to my .zshrc, and it caused a lot of errors when I try to use Bash again. How can you export your .bashrc to .zshrc? ...

Unable to shorten a specific prompt's PATH in Zsh

I run unsuccessfully the following code at /usr/local/bin LBIN=/usr/local/bin How can you change specific prompt's PATHs in Zsh? ...

Unable to understand the question by Zsh

I run the following command unsuccessfully dir and I get zsh: correct 'dir' to 'gdir' [nyae]? What does [nyae] mean in Zsh? ...

Unable to convert Bash script to Zsh script

I need to change the following Bash code to Zsh TODO_OPTIONS="--timeout --summary" cd () { builtin cd "$@" RV=$? [ $RV = 0 -a -r .todo ] && devtodo ${TODO_OPTIONS} return $RV } pushd () { builtin pushd "$@" ...

Unable to find files which have been in the folder one minute in Mac's Zsh

I need to find files which have been in the folder Wastebasket exactly one minute. The files have been moved all over my computer to the folder. I run the following unsuccessfully find -atime n1m . I get all my files in the directory by the command, even ones which I just created. It seems that the option -atime is not correct. How ...

Unable to undo removal in Zsh

I run at path/test rm -r * The tutorial says that I can undo the change by If one of these fancyeditor commands changes your command line in a way you did not intend, you can undo changes withˆ_,ifyou can get it out of your keyboard, orˆXˆU,otherwise. However, I did not get the files back by pressing Ctrl-x Ctrl-u or Ct...