Zsh is a shell with many advanced command-line and scripting features.

learn more… | top users | synonyms (1)

0
votes
0answers
28 views

Neither `less` or `less -X` clear screen on exit

Neither less or less -X clear screen on exit. At the same time, vim does.... Env iTerm2, protocol mosh, server Centos + tmux + zsh iTerm2: report term as xterm-256color tmux: set -g ...
1
vote
2answers
14 views

open tab in gnome-terminal

I ran gnome-terminal --working-directory=$DIR but it opens in a new window, not tab. Things I've tried: --tab -T --add-tab Running RHEL5 with zsh
3
votes
2answers
28 views

zsh solutions to “the argument list is too long”

I read in this answer from @Gilles the following: In zsh, you can load the mv builtin: setopt extended_glob zmodload -Fm zsh/files b:zf_\* mv -- ^*.(jpg|png|bmp) targetdir/ as a solution to ...
2
votes
2answers
286 views

remove a host from the completion list for ssh in zsh

I once had some hosts named 'myhost', 'myhost1', etc. And now all those except 'myhost3' become invalid. I removed those from /etc/hosts and ~/.ssh/known_hosts, but zsh still completes them for me. Is ...
3
votes
2answers
32 views

zmv command to rename file after matching pattern

I was trying to figure out a solution for this question using zmv. I am unable to find an exact solution using zmv. This is what I could come up with so far. From here, I could rename all files like ...
2
votes
1answer
19 views

search files using group permission

If i need to search files using group permission I use the following command echo **/*(AIE) where AIE stand for read/write/execute. For owner and group permissions the qualifier used are rwx and ...
28
votes
5answers
2k views

When do you use brace expansion?

I understand what brace expansion is, but I don't know how best to use it. When do you use it? Please teach me some convenient and remarkable examples if you have your own tip.
2
votes
3answers
177 views

How can a zsh script test whether it is being sourced?

The accepted answer for a similar question for bash does not seem to work for zsh. In fact, if I copy basically the same code given in that answer, to produce the script #!/usr/bin/zsh - # test.sh ...
3
votes
1answer
25 views

In zsh, what is the meaning of the '$==*' idiom

I have found the $==* idiom in several zsh solutions that I use. It seems to be equivalent to $argv. But I don't know how it gets interpreted. Could you explain?
1
vote
1answer
22 views

zsh syntax highlighting for files

I use zsh-syntax-highlighting package and it colorize all files with the same color as directories (path). I think one should have possibility to customize these colors or at least use $LS_COLORS as ...
5
votes
2answers
61 views

How to make *sh lines shorter

I recently encountered a line of zsh code ls_colors_parsed=${${(@s.:.)LS_COLORS}/(#m)\**=[0-9;]#/${${MATCH/(#m)[0-9;]##/$MATCH=$MATCH=04;$MATCH}/\*/'=(#b)($PREFIX:t)(?)*'}} Not only does this burn ...
8
votes
4answers
752 views

Can I reference a command before '&&' after '&&'

Not sure how else to phrase the question, but basically, I often find myself running a command like vagrant to bring up the VM, and then ssh into it like below: vagrant up && vagrant ssh ...
0
votes
1answer
44 views

$PATH environment variable does not seem to be recognized

I've made a fresh install of Debian Wheezy, and installed zsh to it. Few days after, I've done a vanilla installation of TeX Live 2014, so I added the necessary binary paths to my $PATH. Now I started ...
3
votes
3answers
71 views

Automatically put an alias into ~/.bashrc or ~/.zshrc [duplicate]

Is there a command line util/script that automatically saves aliases? E.g. save-alias my-ip="curl ipecho.net/plain" and that will define an alias, then add/update it in ~/.bashrc or ~/.zshrc I was ...
1
vote
1answer
34 views

zshell is tab-completing ambiguous options

I've been having an issue with zsh completion that's becoming a rather large annoyance. It's completing options beyond where there is ambiguity. For example, in a directory with these files: ...
11
votes
6answers
1k views

Portable way to get script's absolute path?

What is a portable way for a (zsh) script to determine its absolute path? On Linux I use something like mypath=$(readlink -f $0) ...but this is not portable. (E.g., readlink on darwin does not ...
0
votes
0answers
20 views

Zsh - Modify File Completion w/ Quotes

I've been using Zsh recently, and when I complete a file name within quotes, the completion adds a space after the completed file name. Interestingly, this does not occur when I complete directory ...
1
vote
1answer
32 views

Move zsh settings from Arch live to Arch regular

I just installed Arch as a guest (Virtual Box), and I really liked the way that the shell behaved on the live version of Arch. What would the steps be in order to copy those settings (from live) ...
0
votes
0answers
27 views

Zsh script cannot find screens

I have created a zsh script launching many screens in detached mode with particular names and running particular processes in them in order to automate some data analysis in high energy physics. ...
0
votes
1answer
29 views

Zsh script how to concatanate array elements with string

I have written a zsh script to automize an analysis in high energy physics and now I would like to use an element of the one of the defined array some string and another element of some another array ...
5
votes
3answers
276 views

cd to directory of a symbolically linked file

Before I write a script, anyone know an easy way to do the following: $ pwd /foo/bar $ ls -l lrwxr-xr-x 1 username admin 48 Apr 17 2012 foo.sh -> /bar/foo.sh $ cd /bar $ ls foo.sh i.e., in ...
0
votes
0answers
38 views

Bash script for opening screens and compiling the same file

I have written a bash script to initiate separate screen sessions and run a command in each of them that compiles the same C++ source file in ROOT (an object-oriented data analysis framework ...
1
vote
2answers
31 views

Livesearch with first 10 matches as preview for zsh-history?

I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r ...
1
vote
1answer
28 views

How to make `less -FX' play nice with a 2-line shell prompt

My shell prompt is two lines long (a fancier version of [%n@%m %~]'$'\n''%#. I have $LESS set to -FX. When I quit less, it leaves a single line at the end of my screen, and since my prompt has two ...
2
votes
0answers
55 views

How can you get the current terminal line (the one that is still editable by the user)?

I need a way to use the current line which the users typed into as variable for a shell function. my current code, which can be called by ctrl+r zle -N search bindkey "^R" search search () { read ...
3
votes
2answers
56 views

How can I check GMail messages with prompt for password from a script?

I'm using zsh on Ubuntu 14.04 over SSH using Putty and I'm setting up the key bindings for my keyboard. Because zsh doesn't seem to make use of my function keys I thought I'd setup scripts to do ...
1
vote
3answers
122 views

Joining files on disk

Say I have several file with the following naming: 000001 000002 000003 ... Each of these files is a csv file (may include escape characters). In total the folder has ~20GB of data. How can I ...
2
votes
3answers
93 views

Display ZSH brace expansion

Is there a way to show the expanded version of a brace expansion statement? For example, I have: $ bundle exec rake db:{drop,create,migrate} Does the expanded version expand to this? $ bundle ...
0
votes
1answer
13 views

Cannot access elements of an array in zsh

I am trying to write a script in zsh and I need to make use of arrays in order to achieve my aim in an elegant way. After reading some information over the Net, I tried to implement and access the ...
2
votes
0answers
93 views

How to write a shell script to run multiple command in different screen sessions?

My goal is to write a zsh script in order to create multiple screen sessions and run separate commands on each of them. I would also like to check at the beginning of my script if there are any ...
4
votes
2answers
70 views

Display possible corrections but do not apply them automatically

I have the following completion: zstyle ':completion:*' completer _complete _approximate As a result if I type something incorrectly and hit TAB I will see a list with corrected propositions (what ...
8
votes
3answers
100 views

Resolve all aliases in a zsh command line

I have nested aliases and I want to resolve all of them before executing the command. How do I do that? If there is a function that is not bound to any keys then M-x foobar is fine for me too. I ...
10
votes
4answers
5k views

How to define and load your own shell function in zsh

I am having a hard time defining and running my own shell functions in zsh. I followed the instructions on the official documentation and tried with easy example first, but I failed to get it work. ...
3
votes
3answers
2k views

After installing oh-my-zsh: … /.zshrc:source:34: no such file or directory … /.oh-my-zsh/oh-my-zsh.sh

I just tried to install oh-my-zsh. I get the following error when I try to run rvm: zsh: command not found: rvm I also get the following error when I try to open a new tab: ...
0
votes
3answers
82 views

Bad substitution error in zsh shell

Hi in my previous question I got clarity on how to use associative arrays in zsh shell. But whenever I trigger the following command in my script for KEY in ${!array[@]} to iterate amongst the keys ...
7
votes
2answers
2k views

16 Colors in ZShell

I only seem to be able to call 8 colors in my zshell prompt. Example: PROMPT="[%n@%{$fg[magenta]%}%m%{$reset_color%} %.] %# " Works fine. However, ...
36
votes
4answers
4k views

How to use `which` on an aliased command?

Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance, alias vim='vim -X' alias grep='grep -E' alias ls='ls -G' The problem is ...
3
votes
2answers
54 views

Show older or newer history items with the history command in zsh

I typed in the history command and it showed me the last 10 commands executed by me. Now I wanted to see the last 20 commands executed by me so (after reading the documentation): An argument of n ...
3
votes
2answers
42 views

Disable glob qualifiers in zsh

Is there a way to disable glob qualifiers with zsh? It seems like a useful feature, but it gets in the way of normal parentheses. I use ag to search files, and ag mymethod(param) causes zsh to ...
2
votes
1answer
41 views

Persistent directory stacks across sessions in zsh

I would like to share my directory stack (the one accessed with dirs) across sessions and tmux panes/windows. In the zshbuiltins man page I have found autopushd to add every directory I switch into ...
0
votes
0answers
14 views

I have downloaded and un-tarred zsh, what do I do next [duplicate]

I am running Linux Fedora 20, and have downloaded and un-tarred tar -jvxf zshell/zsh-5.0.5.tar.bz2, and now have what looks like the correct directory, as in the following listing which also shows ...
8
votes
4answers
3k views

Is it recommended to use zsh instead of bash scripts?

Can I assume that enough people have zsh installed to run scripts with a #!/usr/bin/env zsh as shebang? Or will this make my scripts un-runnable on too many systems? Clarification: I’m interested ...
0
votes
1answer
26 views

All directories wrongly identified as git repos in zsh

I am using zsh and Oh-My-Zsh on Ubuntu 14.04. For some reason all directories are indicated to be git repos. This is true for all oh-my-zsh themes, which leads me to believe that this is a zsh issue ...
4
votes
2answers
2k views

Escaping quotes in zsh alias

Following on from this question about stripping newlines out of text, I want to turn this into a zsh alias as follows: alias striplines=' awk " /^$/ {print \"\n\"; } /./ {printf( \" %s \",$0);}"' ...
7
votes
4answers
257 views

How can I suppress the space between generated arguments during brace expansion?

I used the following command to create a list of URLs that I want to test: echo -e ...
1
vote
1answer
34 views

reset for loop counter

Simple question: if I have a for loop (zsh) over an unreliable list, by which I mean the list contains entries that can't be predicted beforehand, then can I reset the for loop counter? This ...
0
votes
1answer
37 views

Must pass urls in quotes

I'm trying pass a URL to mpv for it to play it as a network stream. This can be done in bash with the following syntax: $ mpv http://myvideosite.com However, zsh wants to evaluate the URL as ...
16
votes
6answers
710 views

How to type several file names with fewer key strokes

If I want to convert a pdf to a png image with imagemagick I do something like: convert -trim -density 400 this_is_a_very_long_filename_of_my_pdf_file.pdf ...
2
votes
1answer
64 views

Why do some letters or escape sequences not render correctly in urxvt?

With a special combination of shell (zsh w/ syntax hightlighting), terminal (urxvt) and configuration with Xresources, I noticed a strange issue with font rendering that only seems to occur with some ...
0
votes
2answers
558 views

Comparison of shells? [closed]

Do shells have any actual advantages or disadvantages? They can all run any binary, they all support pipes and > (output to file). Why would one choose bash over sh, or sh over ksh, etc? Why does ...