Questions tagged [zsh]
Zsh is a shell with many advanced command-line and scripting features.
3,120 questions
0
votes
0
answers
7
views
local zsh history on up-arrow, global zsh-history on ctrl-R
I am looking for a very specific behavior in my Zsh terminals.
I have multiple terminal windows open at the same time.
On each terminal window, if I hit the up arrow, I'd like for it to go up through ...
3
votes
2
answers
194
views
rename directories recursively using zmv
I am trying to recursively rename all folders _Oreilly (exact match) to _OreillyFox
In other words, I am trying to have the same effect as:
find . -depth -type d -name "_Oreilly" -execdir ...
4
votes
3
answers
529
views
Parse console output and audibly say error
I am testing testing app by running mycommand that outputs at the console and directly at /tmp/mycommand.log. Using zsh. mycommand is really a function with parameters, but I can get the same when ...
0
votes
2
answers
97
views
How to redirect output from a program that waits for input
Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables:
#!/bin/zsh
pamtester login $user authenticate <&...
0
votes
1
answer
15
views
create a completion function for tmux-manager
Here is my script:
#!/usr/bin/env bash
kill-all-sessions() {
tmux kill-server
}
kill-other-sessions() {
tmux kill-session -a
}
kill-unattached-sessions() {
tmux list-sessions -F '#{...
0
votes
2
answers
35
views
Stop the cursor at single and double quote
I have a zle like:
function _ctrl-shift-left() {
((REGION_ACTIVE)) || zle set-mark-command # Selection
zle backward-word
}
zle -N _ctrl-shift-left
bindkey '^[[1;6D' _ctrl-shift-left # Ctrl+...
4
votes
1
answer
87
views
How to split output of a shell command on spaces while taking into account quoting?
I have a command that produces a list of arguments, quoting then if neccesary (https://docs.python.org/3/library/shlex.html#shlex.quote). I need them to pass them as command arguments in a zsh script (...
1
vote
1
answer
32
views
How can I make Zsh autocomplete in the middle of a word (like Bash)?
In Bash, when I press in the middle of a word, it suggests completions based on the text up to the cursor, and if I select one, it replaces the current word rather than appending to it or leaving any ...
0
votes
2
answers
84
views
How to analyse a number of different datasets with a script and save the output for each dataset in a different new directory?
I am interested in analysing 50 different datasets with a script and saving the output of each of the 50 analyses in 50 different corresponding directories. To avoid doing this manually, how could ...
-2
votes
1
answer
59
views
Practical difference between $0 and $0:P
When I run the following script in zsh, both $0 and $0:P give me the same output: /Users/john/scripts/test123.sh.
#!/bin/zsh
echo script\'s path: $0
echo absolute path: $0:P
echo ...
1
vote
1
answer
48
views
What is the use case of the `compadd -Q` flag in zsh completions?
When making a custom zsh completion, the compadd function has the -Q option.
The zsh documentation describes the -Q option as follows:
-Q This flag instructs the completion code not to quote any ...
-1
votes
1
answer
40
views
Variables in zsh config files
Let's say your zsh config includes the following lines for Perl:
PATH="/path/to/your/home/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/path/to/your/home/perl5/lib/perl5${...
1
vote
0
answers
17
views
Zsh: How to interleave a constant value with an array, without resorting to looping? [duplicate]
Apologies in advance if this has already been asked. Couldn’t find a duplicate (difficult to find the right keywords for this problem). If this has already been asked and answered, happy to be pointed ...
2
votes
1
answer
32
views
Vanilla tab behaviour with zsh-autocomplete
I’m using zsh-autocomplete (https://github.com/marlonrichert/zsh-autocomplete) and trying to keep my Tab completion “vanilla” (i.e., expand-or-complete instead of selecting the top suggestion). ...
1
vote
1
answer
36
views
Git hook on SSH remote fails due to not reading shell configuration
I'm using a git post-receive hook to perform some actions
after a git push to a remote server. This remote operates
over SSH:
$ git remote -v
server user@server:repo.git
The problem is that ...