Questions tagged [zsh]

The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a powerful command interpreter for shell scripting.

0
votes
0answers
19 views

Problem Starting Login Shell in Cygwin xterm

I am trying to start a login shell within xterm in Cygwin. I am able to start a regular shell no problem. Here is what happens: C:\Users\sridhar>C:\cygwin\bin\xterm -display :0 /bin/bash C:\...
0
votes
1answer
30 views

How can I make a shell pipeline print and slide a word from left to right in the console?

I used toilet to write a simple pipeline to print out my username everytime I open the console and I wanted to be able to get it to slide consistently since the printed word is a few rows tall. ...
0
votes
1answer
9 views

how to include Duplicated commands in history plugin?

I use history a lot, but it seems that it will remove the Duplicated commands, how can I see all my commands include the Duplicated ones? I use history plugin in zsh
0
votes
2answers
31 views

Variable expansion including spaces within alias definition

I'm pretty sure I'm missing something obvious here. I have the following code in my .bashrc and .zshrc for reasons not relevant to the question (but I can explain the reason why if needed, not a ...
0
votes
0answers
9 views

ZSH vcs_info are not updated if alias is used

When I change my branch inside my zsh sadly it is not reflecting the current branch if I use an alias, but works if I use git checkout <branch>. I use oh-my-zsh and my custom theme for oh-my-...
0
votes
1answer
18 views

How do you pass arguments to custom zsh functions?

How do you pass arguments to custom zsh functions? For instance: function kill_port_proc(port) { lsof -i tcp:<port interpolated here>| grep LISTEN | awk '{print $2}' } I'm seeing so many ...
0
votes
1answer
26 views

Conditional Characters in Shell Globbing - Bash/Zsh

I'm trying to get a case statement to match one of four inputs in a Bash/Zsh shell: v -v version --version You can see where I'm going, right? I'm looking for this in the below case statement: ...
-1
votes
2answers
16 views

iterm broken pipe when running tmux from profile command

Getting Broken Pipe when executing tmux command from profile on iterm2. When I execute tmux from command line there is no problem. >echo $PATH >/Users/myname/usr/local/bin:/usr/bin:/bin:/usr/...
-1
votes
0answers
9 views

How flags autocomplete work in oh-my-zsh?

How to get all flags of specific command? For example: $> ls -[TAB] -1 -- single column output -A -- list all except . and .. -B -- print octal escapes for control characters -C -- list ...
0
votes
0answers
38 views

ZSH autocomplete directory based on current $PWD

So I wrote a function behaving like the normal cd with the addition that I am able to navigate back to any directory in my current $PWD. function ccd() { local next_dir=$1 cd $next_dir >/...
0
votes
1answer
22 views

Zsh alias to launch Sublime Text with the current directory opened

I'm using zsh and trying to create a shortcut, stt, so I can open a folder in sublime text. I've currently added an alias that I found on a website, but it only opens a blank sublime, with no files ...
1
vote
1answer
20 views

ZSH Theme not updating from function

I'm trying to write a ZSH Theme that displays specific characters depending on the Git status (if within a git repo). I've previously implemented this theme in Bash, but am having some issues with ...
0
votes
0answers
9 views

zsh completion script with last proposed but not completed

I have an exececutable with 3 options and I want to create a zsh completion script for it. I started to write this script as follow: #compdef _foo foo function _foo { _arguments \ - set1 \ ...
1
vote
2answers
53 views

zsh compinit: insecure directories error message on Mac, after installing Homebrew

After installing Homebrew and Homebrew-Cask on my Mac (as administrator with user-id 'admin', running MacOS 10.12.6), I get the error message zsh compinit: insecure directories, run compaudit for ...
-1
votes
2answers
21 views

Is there a way to define an alias that executes a bin from a specific folder in MacOS?

I am currently using a Macbook Pro running MacOS Mojave 10.14.3. I have recently gotten into ruby programming but find their whole gem package management a little confusing. When i gem install a ...
0
votes
1answer
30 views

${BASH_SOURCE[1]} equivalent in zsh?

I am trying to get the directory of the sourced script, and an important requirement is that sourcing can be nested, and the deepest script is sourced with something like source <(cat file), so the ...
0
votes
2answers
25 views

linux redirection: difference between using “2>&1” before and after “> somfilename”

What is the difference between: $ ls > dirlist 2>&1 and $ ls 2>&1 > dirlist will both redirect stderr and stdout to dirlist.
0
votes
1answer
14 views

zsh: standard error not getting redirected

I have created an empty director for testing $ mkdir test $ cd test $ grep da * zsh: no matches found: * Now i am trying to redirect the error zsh: no matches found: * to a file. (my purpose is ...
0
votes
1answer
14 views

Zsh filename expansion over multiple directories recursively

Problem: I have a directory $BASE, and in this directory (and/or any of the directories below it) are zero or more directory entries matching the pattern *.x. I want to loop over all these entries. I ...
0
votes
1answer
48 views

Run command line via alias with zsh on MATLAB

I use the system/unix command on Matlab in order to run an external program via the command line. I want to execute it via an alias define in .zshrc on my computer. Unfortunately, the alias seems to ...
0
votes
1answer
22 views

zsh aliases don't expand even with option `complete_aliases`

How do I expand an alias defined when using zsh -c? % zsh -c 'setopt aliases complete_aliases; alias d=date; d' zsh:1: command not found: d
-1
votes
2answers
32 views

How do I create a ZSH alias (on WSL) that runs vswhere.exe and executes the path with spaces?

I'm on WSL (windows subsystem for Linux) I'm trying to create an alias to run vswhere.exe, which will tell me where devenv.exe is located, and then run that from my ZSH shell. path1="$(vswhere.exe -...
0
votes
1answer
34 views

In a shell script, how to get current directory of ruby gem executables?

On macOS, I want to make my .zshrc automatically add current location of ruby gem executables to the $PATH variable. Currently I just do: if [ -d "/usr/local/lib/ruby/gems/2.6.0/bin" ]; then ...
0
votes
1answer
12 views

Editing .zshrc to color coat ls output in iterm2 based on file type

So i know there are probably many posts about this, but either i can't find the ones i need or my terminal just hates me. I'm trying to color coat the output of ls with the zsh shell on iterm2 on OSX. ...
0
votes
1answer
11 views

ZSH Completion Delimiter

I ran into the following situation. I got autocomplete entries like those: server:install server:lint ... Those should be completable by zsh. Actually my completion method works kind of nice, as ...
2
votes
1answer
41 views

I am not able to install Miniconda on MacOS X with Homebrew and .zsh

Please help, I tried to install Miniconda on Mac OS X Mojave with: brew cask install miniconda then I added export path to .zshrc file (Oh my Zsh): export PATH="$PATH:$HOME/miniconda3/bin" But it ...
0
votes
1answer
28 views

Bash - autocomplete <TAB> - find all occurence and auto select one

I have checked a lot of other answers but did not really find what I am looking for. Problem is I need to reproduce this with a bash auto-completion a zsh function: If I got this: : ls -l drwxr-xr-x ...
-1
votes
0answers
8 views

How to feed zsh history file to autojump?

autojump uses bash command history to achieve auto-jump. But for a new user, the database is empty. But as a zsh user, I have lots of commands in the history file ~/.zsh_history. How can I make use ...
0
votes
1answer
60 views

ZSH “command not found: z”

iterm2 ohmyzsh In 'zsh' I can't use 'z' to search folders, appears command not found: z I try to run source "$(brew --prefix)/etc/profile.d/z.sh" and source /usr/local/etc/profile.d/z.sh but ...
0
votes
1answer
20 views

Ruby gem tab completion on zsh produces “doubled rest argument definition” error?

When I hit gem push <tab>, it displays this error (regardless of whether the directory contains any .gem files): _arguments:comparguments:325: doubled rest argument definition: *:gem:_files -g "...
0
votes
2answers
45 views

How to detect OS and load ZSH settings conditionally?

I use several different OS's at home and work and I want to be able to load platorm-specific ZSH settings conditionally, depending on which OS I'm using at the given moment. I tried this but it doesn'...
1
vote
0answers
21 views

What is the bindkey equivalent to bind -x?

In this question, the inimitable Dennis Williamson mentions how to bind a keystroke to a command that will run in the background of the Bash shell, with bind -x. How can the same thing be done in Zsh?...
12
votes
3answers
256 views

Background and foreground bash/zsh jobs without adding newlines in “continued/suspended” messages

I have a process that goes something like this: Run a command that generates a bunch of results in a bunch of files Open a file in vim Edit one of the results Background vim, get the next result, ...
0
votes
2answers
28 views

Enter a command for a user

I have written a ZSH function whose output is a command line which runs a program I need the user to be able to interact with. At the moment I just echo the command line and instruct the user to copy-...
0
votes
1answer
21 views

How to add a command to the zsh history from python

I am writing a shell wrapper script (term-cheat) in python that can be used to find, collect and execute shell commands. I would love to add the executed commands to the shell history. I tried several ...
0
votes
1answer
45 views

How to add a command to the bash history from python

I am writing a shell wrapper script (term-cheat) in python that can be used to find, collect and execute shell commands. I would love to add the executed commands to the shell history. I tried several ...
0
votes
1answer
10 views

ipython receiving control characters in iTerm2

If I initialize ipython using iTerm2 and press enter ipython receives extra control characters. How do I debug this? I've tried using bash instead of zsh and same problem happens in iTerm2. I don't ...
0
votes
0answers
47 views

How to undo a sed cli .zsh

I am on Ubuntu 18.04.1 LTS As I use very often "clear" in my zsh terminal, I wanted to delete it from my .zshrc_history file. I found this command line : sed -i '/string/d' .bash_history here ZSH / ...
0
votes
0answers
32 views

How can I source a script using a zsh function, without spawning a subshell, to set environment vars?

I'm trying to run a zsh/bash script that writes several values to environment variables, I want these variables available to the parent shell as they are required for several tools we use. If I ...
0
votes
0answers
26 views

Find file with highest (purely numerical) filename

Given a directory, which among its entries has at least one with the following properties: It is a directory file It's name consists only of digits My goal is to find of all these directories the ...
0
votes
1answer
36 views

How would you create a terminal alias to watch the latest log file update in real time? [duplicate]

Situation: I want a one line command that can pull out the latest log (updates hourly), and watch as it changes. Here's an attempt that might explain less obscurely: tail -500f $(ls | grep ...
1
vote
0answers
27 views

Zsh on windows using Cygwin

I installed zsh via cygwin, but it shows some errors when started and the prompt looks wrong. jason@Febi ~ $ zsh 2 [main] zsh 5052 child_info_fork::abort: address space needed by 'newuser.dll' (...
0
votes
0answers
15 views

zsh terminal not works correctly on mac

I just installed zsh on my mac, but get not ~ but MBP% on terminal after user name
0
votes
1answer
35 views

How to complete a variable number of arguments containing spaces

I've build a command line tool and I need to complete arguments with zsh. I never wrote a zsh completion function so I looked in the scripts provided with zsh but I missed something so that it could ...
0
votes
2answers
37 views

Does creating WAR file using zip command affect the performance of my web application?

I have this WAR file that I need to deploy using BladeLogic Server Automation and then edit some XML files inside the WAR file. My plan is to extract the WAR file using unzip command, then edit the ...
1
vote
0answers
35 views

zsh using prezto startup prompt extremely slow

I'm using zsh with prezto. The startup prompt is extremely slow. I use iTerm2 on Mac. Here is my ~/.zshrc # # Executes commands at the start of an interactive session. # # Authors: # Sorin ...
0
votes
1answer
76 views

How to bind fzf to zsh key?

I have fzf fuzzyfinder set up on Ubuntu 18.xx fzf finds the file but it prints on the terminal when I select it. How can I add a shortcut to zsh for fzf so that the selected file opens in vim ...
0
votes
1answer
50 views

How to make cursor show as vertical line in insert mode and as block in normal mode, in vim on iterm2

How to change vim cursor to vertical line in insert mode, and block in normal mode, iterm2. mac osx I have tried some other configs, i found online which said it would fix it but none of them worked. ...
0
votes
1answer
18 views

How to hide time elapsed shown in zsh after every command

The time elasped is showing for all the themes, i am unable to turn it off. Additionally, there is a bug, it shows empty spaces sometimes and after few commands it comes back on. Screenshot of the ...
2
votes
1answer
64 views

Why does substring extraction extract entire words instead of characters?

Given a file test.txt, with the content This is a test. I want to extract a substring of its content, more specifically the second and third character ( hi ), using the command echo ${$(cat test.txt):...

http://mssss.yulina-kosm.ru