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

learn more… | top users | synonyms (1)

0
votes
0answers
7 views

zsh git command auto-complete add extra origin to the git branch name

After I clone a git repository locally, I want to switch branch to, says, 'ABCD'. $ git branch -a * master remotes/origin/ABCD remotes/origin/HEAD -> origin/master remotes/origin/master $ ...
1
vote
0answers
11 views

Is there a better to find out the script location which is part of a zprezto module?

I am writing a custom module to extend the zprezto framework for myself. The goal is to be able to start a tmux with proper configuration by name. Here is the code of the init.zsh of my custom module: ...
2
votes
1answer
24 views

Combining zsh’s tab completion with case insensitivity

I have zsh 5.0.7 configured to use case-insensitive tab completion with zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' The problem I’m having is that this case insensitivity often leads ...
0
votes
1answer
21 views

How to turn on tab completion in zsh/prezto?

I have installed prezto and trying out zsh. However tab completion is not on by default. What is the best way to enable tab completion in prezto?
2
votes
0answers
21 views

Why does select-word-style stop me from using backward-kill-word for leading whitespace?

If I have just some whitespace at be beginning of my zsh prompt, I can usually ^W (backward-kill-word) it away. However, as soon as I load select-word-style - even if I don't select any special style ...
3
votes
1answer
53 views

Why is `setopt nohup` required to make `nohup watch` work in zsh?

In zsh, setopt nohup seems to be required to make nohup work, as follows: # nohup does not work without setopt nohup ➜ /tmp zsh ➜ /tmp nohup watch ls & [1] 31556 nohup: ignoring input and ...
0
votes
1answer
25 views

Is there a valid way of exporting a variable across different shells?

For some reasons, Im using ksh and zsh in my scripts and returning to -bash, I need to use already set variable values in the spawned shells, writing it to some temp file and using that didn't look ...
1
vote
0answers
43 views

How can I complete a -N numeric parameter?

I'm writing an autocomplete script for supervisorctl. Is it possible to complete a numeric parameter such as -6, -999 etc? Currently my call to _arguments looks like, which doesn't work: _arguments ...
1
vote
1answer
40 views

Ctrl-Arrow does not work anymore after installing Prezto

I have this in my .inputrc: "\e[A": history-search-backward "\e[B": history-search-forward set show-all-if-ambiguous on set completion-ignore-case on # mappings for Ctrl-left-arrow and ...
3
votes
1answer
55 views

Filename expansion from date ranges

Consider dates in the ISO 8601 format i.e. ‘YYYY-MM-DD’, e.g. 2015-01-28, and say we have a folder with files of the form: AAAA_<date>_BBBB I am looking for a glob pattern in zsh (or Bash) ...
2
votes
1answer
62 views

terminal converts first letter to uppercase

After a $ vagrant ssh into a Centos 7 VM, - If I type a command in the VM terminal that uses zsh shell, the first letter gets uppercased. How can I stop this behaviour? I briefly looked at $ stty ...
2
votes
1answer
46 views

Multi-month view in calendar (cal) in OS X

I am hoping to run some of the commands listed in this article, e.g.: cal -3 which is supposed to show me the last month, this month, and next month. This command does not work in OS X. $ cal -3 ...
2
votes
2answers
68 views

Export Command History into a Shell Script

Often I have complicated installation procedures to follow, like having to build dependencies for buildtools, to build dependencies for the application I wish to install from source. Once I have done ...
1
vote
2answers
49 views

Why does zsh allow name to be null in ${name:-word}?

From zsh documentation: ${name-word} ${name:-word} If name is set, or in the second form is non-null, then substitute its value; otherwise substitute word. In the second form name may ...
1
vote
2answers
61 views

ls .. doesn't work properly with symlinks

I have directories set up a bit like this ~/code ~/code/src ~/code/build -> /path/to/somewhere/else That last one's a symlink. If I do this cd ~/code/build ls .. then I get the listing for ...
1
vote
1answer
56 views

Every time I run tmux, new ssh-agent child process is started (zshell)

Every time I start tmux or split tmux, new instance of ssh-agent is started ("Agent pid XXXX" appears on the top), which is quite annoying because I have to type the key password every time I want to ...
3
votes
2answers
107 views

Compatibility scripting: Save $? for use later

I would like to write a small part of a script that saves the error status, executes some other code, and sets the error status to the original error status. In Bash it looks like this: << some ...
4
votes
1answer
112 views

Tab autocompletion of accented characters with oh-my-zsh doesn't work

I am not able to properly display autocompleted filenames that contain accented characters like ã in my shell configuration of zsh and oh-my-zsh. I've created a filename cão.txt to demonstrate this ...
1
vote
2answers
56 views

Zsh completion on the second command or after an alias?

I have changed my OS X Yosemite shell to Zsh and configured with "oh my zsh" plugins, recently i installed proxychains-ng to proxy command line tools, but i found zsh completion does not work on the ...
1
vote
3answers
146 views

How could I reach root after switching from bash to zsh?

It's very weird that after switching to zsh from bash, I can't access root. I normally use 'su' to login as root after I login as a normal user (username is normalusername) with less privileges. And ...
0
votes
1answer
17 views

Why urxvtc doesn't accetp zsh functions when called with a “-c” argument?

In order to launch a new terminal and run a zsh function on it, I am trying to run the following command from within an urxvtc terminal (the urxvtd is running as a systemd service) urxvtc -e zsh ...
4
votes
2answers
181 views

Running commands stored in shell variables

The following works in my shell (zsh): > FOO='ls' > $FOO file1 file2 but the following doesn't: > FOO='emacs -nw' > $FOO zsh: command not found: emacs -nw even though invoking emacs ...
1
vote
2answers
83 views

Passing a command with arguments to a script

I am trying to write a shell script that receives as an input a command with arguments and runs it. As an example, I am hoping to use this in cron as follows: 0 11 * * * my_wrapper.sh "task_name" ...
1
vote
1answer
87 views

Redirection differences between &> >& and 2>&1

On this SO thread and a few other threads I have seen the following commands for redirecting stdout and stderr to a file. Are they all equivalent? Is there any difference between them? command1 ...
0
votes
1answer
43 views

how to find file defining an alias

I am having a problem I'm not sure how to get around. Somehwhere on my system, I have an alias defined as such: alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\' I ...
8
votes
3answers
348 views

How can I list all shell variables?

Reading about this question: In zsh how can I list all the environment variables?, I wondered, how can I list all the shell variables? Also, does the distinction between shell variables and ...
1
vote
1answer
22 views

Switching shells for one cron job

Say I have the following in my crontab: * * * * * command1 -option A; command2; command3; etc. I would like cron to run the commands I have in that line with a specific shell. How can I do that? ...
4
votes
0answers
59 views

Change Zsh theme in Android Studio

I've recently jumped ship to zsh and I'm using the Oh my Zsh! theme blinks. It looks very nice in the OSX Terminal, but it looks very bad in Android Studio's terminal. So my question is is there a ...
2
votes
1answer
30 views

Pipelines, Jobs and Processes in Zsh

I went through the Jobs & Signals documentation in Zsh, but some things aren't still clear to me. It says: If the MONITOR option is set, an interactive shell associates a job with each ...
1
vote
1answer
36 views

When using zsh tab-completion, Ignore CDPATH if a local file or directory matches

I love Z shell's tab completion with CDPATH, but sometimes it's overkill. I'd like it to only kick in as a fall-back if nothing in the local directory matches. For instance, I was just in ...
1
vote
1answer
62 views

zsh colored prompt

this is my PROMPT PROMPT='%{$fg[green]%}%n%{$reset_color%}@%{$fg[white]%}%m%{$reset_color%}:%{$fg[yellow]%}%~%{$reset_color%} $(git_super_status) %{$fg[white]%}\$%{$reset_color%}' Yes, the new line ...
3
votes
1answer
76 views

Problem with passing parameters containing spaces and wild card characters

I have a problem passing parameters if the parameters may contain wildcards and/or spaces, if those parameters are optional. Since this sounds pretty abstract, let's have a small example: The ...
3
votes
1answer
32 views

Keep the space after completion for some characters in zsh

Zsh has a bit of completion-related automation that's nice most of the time: after pressing Tab, a space is inserted automatically (or some other appropriate character such as , inside braces). I ...
1
vote
1answer
38 views

Cygwin: CD to Windows paths easily

In Windows paths are (unreasonably) long, so it is common to drag and drop from some links to the terminal or copy and paste paths from file managers. It is possible to put in the shell init file a ...
1
vote
2answers
27 views

Why is $COLUMNS not listed by either env or set? (on zsh)

I can $ echo $COLUMNS 95 and get a result, but if I env | grep COLUMNS or set | grep COLUMNS I get nothing. (Update: I just discovered that the behavior is different on bash. I'm using ...
1
vote
2answers
54 views

gnome-terminal : small gap at right side of screen (Ubuntu)

I use gnome-terminal on Ubuntu, and when the window is small (not maximized or fullscreen), my tmux statusline and the ZSH right prompt both stretch to the extreme right of the window, which is ...
1
vote
1answer
30 views

Why does oh-my-zsh pick .zhistory instead of .zsh_history for the value of HISTFILE?

I tried googling about this but couldn't find any clue: Why does oh-my-zsh pick .zhistory instead of .zsh_history for the value of HISTFILE? Seems like .zsh_history is what more people would expect.
2
votes
2answers
116 views

Use Netrw or Nerdtree in Zsh/Bash to select a file BY BROWSING?

Often I find myself in the shell, wanting to insert a filename into a lengthy command. I'd like to hit a shortcut, and use Netrw or Nerdtree to browse for a file or directory, and have it pasted in ...
0
votes
2answers
57 views

How can I expand all variables at the command line in Zsh?

In an earlier question, specific to bash, I asked How can I expand a relative path at the command line, with tab completion? I liked @Mikel's answer that mentioned using Ctrl+Alt+e to expand all ...
2
votes
2answers
210 views

Update process name in shell, is it possible?

In C/C++ it is in general possible to do strcpy(argv[0], "new process name"). It's a hack used in malicous software to hide real process name. Is such operation possible via shell? What I want to do ...
2
votes
1answer
53 views

Zsh: Expanding hashed directory names in prompt

I am experimenting with moving from bash to zsh, and in particular with the hash function; so that hash -d Do=~/Downloads means I can enter cd Do to move immediately to that directory. Nice. But ...
2
votes
2answers
144 views

How to read from a named pipe after the writer process exits?

I want to use named pipes as asynchrnonous task queues (JMS-like, perhaps). For example, suppose a client sends some data that I wish to insert into a database, but I want the client to disconnect ...
1
vote
0answers
16 views

autojump : favor folders that share the most parents with current directory

Say I have following folders hierarchies : /home/kray/virtualenv/dev1/myproj/bin /home/kray/virtualenv/dev2/myproj/bin And i type in a console: $ pwd ...
2
votes
1answer
242 views

oh-my-zsh style completion for directory/file paths without oh my zsh

I had oh-my-zsh installed for a while, and I could type a full path using only one letter, then press tab to case-insensitively autocomplete the whole thing. For example, if I had a file at ...
2
votes
3answers
107 views

How to sort filenames with spaces in them and concatenate the files?

I have the misfortune of dealing with filenames that contain spaces. I want to concatenate files of which filenames contain spaces. I also want to sort the filenames numerically. Obviously the ...
4
votes
1answer
76 views

Are there problems with hyphens in functions, aliases, and executables?

In my testing (in Bash and Z Shell), I saw no problems with defining functions or aliases or executable shell scripts which have hyphens in the name, but I'm not confident that this will be okay in ...
0
votes
0answers
33 views

How to show gemset in ZSH-prompt if rvmrc is used?

There are several ZSH themes that presents the gemset in the prompt by calling "rvm-prompt". For example, the "gallois" theme: example My question is if it is possible to only show this if the ...
1
vote
1answer
63 views

Incrementing/decrementing a number in a file from a ( zsh ) script

From a script ( running multiple times simultaneously ), I would like create a file something like: echo "0" > /tmp/count Then I would like to do three functions. incr /tmp/count decr ...
4
votes
1answer
312 views

Why ZSH ends a line with a highlighted percent symbol?

I've noticed this on occasion with a variety of applications. I've often thought it was because the output was cancelled early (ctrl+c, for example) or something similar, and zsh is filling in a new ...
5
votes
3answers
220 views

Shell/Bash script: Properly drop privileges

Okay, first of all, I know this question has been asked a few times here, but the answers given did not entirely satisfy me. The situation is the following: I have written many scripts to automate ...