zsh

ZSH tab completion - don't fill in first file

Hi If I have files "something1" and "something2" in a folder, how do I make ZSH's tab completion fill in only the common characters? For example, I would type: som<Tab> and I want it to fill in with "something", not "something1". Current zstyles: zstyle ':completion:*' special-dirs true zstyle ':completion::complete:*' use-cache on...

How to tail -f the latest log file with a given pattern

Hello, I work with some log system which creates a log file every hour, like follows: SoftwareLog.2010-08-01-08 SoftwareLog.2010-08-01-09 SoftwareLog.2010-08-01-10 I'm trying to tail to follow the latest log file giving a pattern (e.g. SoftwareLog*) and I realize there's: tail -F (tail --follow=name --retry) but that only follow o...

[zsh] unpack string in variable

Hi, In Bash, I can use the following code: [ "$sshcmd" = "" ] && sshcmd="ssh -someopts myhost" $sshcmd "echo hello world" In ZSH, the same code does not work because it tries to find a "ssh -someopts myhost" executable. How can I do the same thing in ZSH? Thanks, Albert ...

[zsh] get list from line-separated output

I want to get a ZSH list from a line-separated output. In my case, from the following command: ssh myhost ls /Applications I tried $(ssh myhost ls /Applications) but that doesn't work (it splits also at spaces). ...

[zsh] Remove entry from array

Hi, I want to do sth. like this: foo=(a b c) foo-=b echo $foo # should output "a c" How can I remove an entry from an array? foo-=b does not work. The removal should work no matter where the entry is. ...

[zsh] add string at beginning of each array entry

For example, I have a=(1 2 3) and I want to get a=(foo1 foo2 foo3). What would be an easy/clean way to get that? ...

[zsh] Problems with ${(z)var}

Code: HOST=localhost PORT=1234 RSYNCCMD="rsync -avP -e \"ssh -p $PORT\"" ${(z)RSYNCCMD} root@$HOST:"\"/foo\"" /bar Output: rsync: Failed to exec ssh -p 1234: No such file or directory (2) ... If I enter the same thing (rsync -avP -e "ssh -p 1234" ...) directly into the console, it works. How do I fix it? ...

Zsh questioning correct command, How to stop!

I just started using Zsh lately for some of the integrated support in the shell prompt for my Git status etc. When I type in ruby -v, to confirm the version of ruby I'm running, Zsh asks if I want to change the command to _ruby. Well after saying no at the prompt and the command completing as expected I continue to get the question at t...

Zsh alias not working as in bash

I use this alias in my .bashrc but doesn't seem to work in zsh using .zshrc. Other aliases I use are working fine so I know the .zshrc is source other aliases. alias rubydev3="cd ~/code/ruby/rails/rails3projects/" This is the error message: cd:cd:10: no such file or directory: /home/jryan/code/ruby/rails/rails3tutorial/ I don't know...

which short-cut in Zsh does the same as Ctrl-u in Bash?

hi, i know this is probably a silly question. But i googled and searched here, didn't get answer. in Bash, when I was typing a command, i press Ctrl+u, all characters from the beginning of the line to the cursor are gonna be removed. However, in zsh, if I pressed ctrl+u, the whole line is gone. How to do the same in Zsh? Thank you. ...

How can I have term.el (ansi-term) track directories if using anyhting other than bash.

When using eshell or ansi-term and bash emacs changes the default-directory variable depending on what directory you are in. So if I move to /home/user/code/project and then use ido-find-file to open a file it starts ido with the CWD. If I use ksh (my normal shell) or zsh (tried for testing) it doesnt work. Is there a setting or is this...

What does "local -a foo" mean in zsh?

Zsh manual mentions that option -a means ALL_EXPORT, ALL_EXPORT (-a, ksh: -a) All parameters subsequently defined are automatically exported. While export makes the variable available to sub-processes, the how can the same variable foo be local? ...

Using zsh completion outside zsh

What is the best way to use zsh completion outside zsh? I know that I can redefine compadd builtin with custom function and parse its options, but is there a better way? I want to add omni completion for shell scripts to Vim based on zsh completion system. ...

Shell Script That Can Check if it Was Backgrounded at Invocation

Hi All, I have written a script that relies on other server responses (uses wget to pull data), and I want it to always be run in the background unquestionably. I know one solution is to just write a wrapper script that will call my script with an '&' appended, but I want to avoid that clutter. Is there a way for a bash (or zsh) script...

zsh vi mode status line

Is there a way in zsh or bash to have a status line? e.g. in VI it will let you know that you are in insert mode with -- INSERT -- Is there an eqivalent for the command line? ...

changing the prompt style of a virtualenv instance with zsh

I would like the change my zsh prompt style for every virtualenv instances that i use or create. My actual promp is like this: declare PS1="%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%3~ %{$reset_color%}" When i activate a virtualenv it just add some an information before the prompt:...

Shell script question

Hi, I want to execute following command in shell script cp /somedire/*.(txt|xml|xsd) /destination/dir/ But this does not run inside shell script. Any quick help? createjob.sh: line 11: syntax error near unexpected token `(' My shell is zsh. Thanks Nayn ...

Using file descriptors to communicate between processes

I have the following python code: import pty import subprocess os=subprocess.os from subprocess import PIPE import time import resource pipe=subprocess.Popen(["cat"], stdin=PIPE, stdout=PIPE, stderr=PIPE, \ close_fds=True) skip=[f.fileno() for f in (pipe.stdin, pipe.stdout, pipe.stderr)] pid, child_fd = pty.fork()...

Cucumber: pipe output without losing color

I'm using cucumber to run some tests. It colorizes its output using ANSI escapes. This is great, but currently its producing more output than I care about, and shoving things I do care about off the screen. There doesn't seem to be a way to eliminate the other lines from within cucumber, but I can pipe the output through grep to pare ...

Zsh completion resource?

Zsh completion is a rather complex beast, and I find the man-page very difficult to read, especially it's missing (simple) examples of all the various optspec forms etc. I haven't managed to find anything online myself yet so help would be most appreciated. As an example here's what I'm struggling with at the moment, and the zshcompsys...