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.
5,981
questions
0
votes
0
answers
20
views
gcloud command completion for zsh adds extra (breaking) escape characters [closed]
How do I get gcloud compute ssh to stop adding unnecessary escape characters for spaces when I use command-line completion? For example, when I type gcloud compute ssh and then hit <tab> this is ...
1
vote
1
answer
21
views
Expanding/resolving variable inside single quotes in zsh alias function
I have a nice one-liner that I want to create an alias of. An instance of that one-liner looks like the following:
less +G $(find /var/logs -name 'service-output.root*' -printf '%T@ %p\n' | sort -n | ...
0
votes
0
answers
27
views
Running r and install.packages("languageserver") in terminal returns zsh: number expected [closed]
> r
> install.packages("languageserver")
> zsh: number expected.
I am having this error in terminal while running command r.
Need some help.
I'm trying to run R in vscode but face ...
-1
votes
0
answers
11
views
Local input conflicts with server autocompletion
I am using zsh and kitty terminal on ubuntu22.04. And I want to connect to my mac with ssh. There is zsh with autocompletion on the mac. After connecting to it, my input conflicts with the ...
0
votes
0
answers
42
views
Chown command not found. (MacOS Terminal) [closed]
I was trying to install homebrew and it told me:
Error: Can't create update lock in /usr/local/var/homebrew/locks! Fix permissions by running: sudo chown -R $(whoami) /usr/local/var/homebrew
So ...
-3
votes
0
answers
57
views
I am trying to run cs2 on m1 mac, and for that i needed to install this script but it is giving me a curl error [closed]
So here are the list of the command i input, first i downloaded "command line tools for Xcode 15", then in my terminal i ran the following commands:
softwareupdate --install-rosetta
arch -...
0
votes
1
answer
71
views
How to understand the "$0" "$@" after `exec python3 "$0" "$@" `
I do not quite follow the following code snippet from https://github.com/nodejs/node/blob/main/configure#L6-L16.
In particular, what does "$0" "$@" mean right after sh -c ```<...
0
votes
0
answers
50
views
auto-apply permissions to any *.sh script
I'm wondering if there is some magical mechanism that will allow me to apply UMASK settings to specific file types.
It took many years but I'm finally irritated with running a chmod u+x script.sh on - ...
0
votes
0
answers
26
views
SLURM and Docker, accessing reserved GPUs not working with zsh
I'm running docker containers on a server using SLURM.
Generally, I connect to a manager node, and run my jobs on one of the other nodes by using:
srun -w gpu02 --gres="gpu:xxx:1" --cpus-per-...
0
votes
1
answer
14
views
Unable to activate venv from python makefile
I have the following python makefile.
.ONESHELL:
TEST_DIR = ./tests
DIR_NAME = $(shell date "+%Y-%m-%d_%T")
.PHONY: clean test backup env
env:
. .venv/bin/activate
test: env clean
...
0
votes
1
answer
28
views
zsh: How to pass a variable into a command?
I have a one-line instruction that works if I put put in a constant, like so:
westk@westkent:~$ echo $dat | jq -r '.[] | select(.Name == "ADM111_1")'
{
"ID": 300035,
...
-1
votes
0
answers
36
views
Auto expand envrionemental variables containing paths in zsh
In bash, I used
shopt -s direxpand
To automatically expand environmental variables containing paths when I type these. For instance if in my .bashrc I defined a variable such as:
export MY_PATH=/path/...
0
votes
1
answer
33
views
Using grep on macOS Monterey
I'm trying to use grep to locate a term in files on macOS Monterey, on Linux I use:
grep -Rnw ./ -e "subject" --include=*.{c,cpp,js,xml}
This doesn't work in a terminal on macOS Monterey. ...
1
vote
1
answer
36
views
Why does a token starting with '=' change semantics of a command in zsh?
The following shell command requires no explanation
a=1
However, when an extra space is added, zsh gives an unexpected error
a =1
zsh: 1 not found
Could someone explain this, please? What is the ...
0
votes
1
answer
42
views
Shell script works when run manually, fails if run by a launch agent
I have a script that I am trying to get to run at login. The script is meant to clear the contents of the Desktop, Documents, and Downloads folders.
I'm using a launch agent to trigger the script to ...
0
votes
0
answers
9
views
Error running after installing ncl on Mac1
I'm a user using ncl in m1mac. I'm trying to run it after installing it through Anaconda, but a command not found error occurs.
I've also confirmed that ncl is installed in the anaconda3 folder, and ...
1
vote
1
answer
19
views
How to keep zsh histories separate by application?
I'm using zsh for system administration and development. The development part happens mostly in VS Code where I use git commands and stuff like that. Is it possible to open a zsh instance specifically ...
0
votes
1
answer
32
views
Postpending addition persistently to $PATH in zsh with line in .zshrc
I have an directory on my $PATH that I need to remain in first position . I added a new directory to my $PATH via the entry
export PATH="/home/me/Tresors/my_tresor/ClientFilter/publish:$PATH"...
1
vote
0
answers
43
views
Cannot copy text from tmux integrated terminal in update 1.82.2
I solved this issue of copying text from tmux window inside Visual Studio Code's integrated terminal by holding Option key but with the latest upgrade to 1.82.2 I am not able to copy the text from ...
0
votes
0
answers
19
views
Issue logging into GitHub CLI to interact with GitHub from terminal
Using terminal command "gh auth login -s 'user:email' -w"
and it keeps saying...
"-bash: gh: command not found".
When I closed and opened the terminal entering the same thing, it ...
0
votes
1
answer
36
views
zsh: replace custom text with a hyperlink
I have a command that outputs a lot of text that has some numbers within the output, specifically 20-digit numbers. These 20-digit numbers are identifiers to a specific web resource (like https://...
0
votes
0
answers
29
views
"read" command does not wok in /bin/sh script
I need to read output of one command into variables. Here is simplified examle:
#!/bin/sh
echo AAA BBB | read X Y
echo $X
this echos empty string.
Whereas when i use /bin/zsh as shell, it works as ...
0
votes
0
answers
18
views
unison only works from macOS to debian not vice versa - zsh:1: command not found: unison
I can sink my files from mac to other devices, however vice versa I get the following error:
unison /home/debianuser/sync ssh://macuser@workingip/Documents/insync
zsh:1: command not found: ...
0
votes
0
answers
13
views
Relay a subcommand completion candidate to another command completion candidate in zsh
I have aliases to other commands in the subcommand of the my command.
To give a concrete example, I want to create a subcommand like mycli dev gcloud, and I want the candidates completed with mycli ...
-1
votes
0
answers
33
views
flutter command working in bash shell but not in zsh on macos using fvm [duplicate]
I am not able to use flutter --version or any other command on zsh it says
zsh: command not found: flutter
But the same command works in bash shell.
I am using fvm to manage my flutter versions
I ...
0
votes
0
answers
28
views
How to solve zsh command not found error graphql-faker
I am trying to use graphql-faker package in my nextjs project. As stated in the documentation https://github.com/graphql-kit/graphql-faker i run
npm install -g graphql-faker the graphql-faker --open ...
0
votes
0
answers
52
views
How can script command line arguments be parsed portably?
I have a script that I use to take screenshots. It runs maim in the background and provides a more convenient interface than just running the command by itself (much less to type, simpler, mnemonic ...
0
votes
1
answer
25
views
How to make prompt current directory name in bold using powerlevel10k?
I'm using oh-my-zsh, powerlevel10k, colorls and fig to customize my mac terminal. Now i have just one issue that i want the current directory name in bold.
see pics to better understand
Initially by ...
0
votes
1
answer
34
views
create zip file with variable in zsh (macOS)
How can I create a zip file in zsh where I can include the appropriate files / folders by variable:
#!/bin/zsh
files="/var/log/install.log /var/log/jamf.log"
zip -r /private/tmp/archivtest....
1
vote
1
answer
34
views
Shell script: curl download fails but browser downloads successfully
I seem to have run into some server side logic that's preventing me from automating the installation of Respondus LockDown Browser for Mac.
When I download the installer from a gui web browser, the ...
-1
votes
0
answers
21
views
Mac OS - $PATH not getting exported to the child process
I am running a Java program from a terminal window. The program displays the PATH environmental variable:
println(System.getenv("PATH"))
For simplicity, let's call this Java program "...
-2
votes
0
answers
52
views
I can't use dogo command after install package (golang), vscode show "zsh: command not found: dogo"
I just started to learn go. I try to install package dogo from this link: https://github.com/liudng/dogo (to auto compile when code change) when I finished all step I can't use dogo command, vscode ...
-2
votes
2
answers
32
views
How can I use `find` to quickly search for, and return the location of, a specific directory on macOS without knowing where it might be? [closed]
I'm creating a CLI for my team to automate some repetitive tasks that we have to do. In order to avoid them having to configure the CLI with where their project is located, I'd like to search for the ...
0
votes
1
answer
56
views
Can the emacs shell do prompt completion like zsh?
I'm a newbie to emacs, and I know that zsh can be called from the M-x shell in emacs, but zsh on emacs doesn't have prompt-completion anymore, and I'm wondering if there's a way to fix it, or if there'...
0
votes
1
answer
52
views
ZSH automatically run commands after selecting FZF result
I'm using ZSH and am trying to integrate FZF into my config. It all works fine now, the only thing bothering me is that after searching for the command I want to run in FZF (e.g. a file/directory name)...
0
votes
0
answers
27
views
zsh: Killed MacOS terminal [duplicate]
when I type python3 into the terminal on Visual Studio Code I get:
Python3
zsh: killed python3
I also get the same thing in my terminal on my laptop.
I've browsed the internet for a solution and ...
-1
votes
0
answers
21
views
Why is the $path I set in zsh not permanent? [duplicate]
I installed mysql but am getting the "command not found" prompt. I am specifically trying to set the path using zsh and am not looking for answers using bash. I tried to set the $path using ...
-4
votes
0
answers
75
views
why does my git merge tool p4merge return a WARNING on secure coding and hang in here?
question:
I am trying to test the merge tool p4merge in macOS zsh git but get an unexpected warning on Secure Coding. How can I fix the warning and make it run properly?
Merging: mytxtfile.txt ...
1
vote
0
answers
27
views
macOS -- Maven environment variable do not take effect
I'm using zsh as my terminal and trying to install maven, After I tried to set environment variables, the mvn command still prompted:
zsh: command not found: mvn
I added the following code in my ....
0
votes
2
answers
71
views
Use values in input csv to search a second csv and return values
I have an input csv with 3 columns and many rows. For each row, I want to use the string in each column to sequentially search a second csv. When a match is found I want to return columns from the ...
0
votes
1
answer
31
views
Is there anyway to skip the uppercase or lowercase in schell script? [duplicate]
I have images starting with favorite-foodname.jpg
My script should move all images starting with fav but end differently
so the script say fav*.jpg
But the images i recieved are in uppercase ( Fav.. ),...
0
votes
0
answers
27
views
ZSH auto completing with `gitfast` is not disabling internal `git` completion
I enabled gitfast plugin with antidote and it seems to be enabled. but if
I do not move the
mv /usr/share/zsh/5.9/functions/Completion/Unix/_git /usr/share/zsh/5.9/functions/Completion/Unix/_bugit
...
0
votes
2
answers
47
views
Why both the set and unset commands don't work as expected in my macOS terminal
I'm very confused by this result.
I have two questions.
What's wrong with that?
What are *, @, and argv?
$ set GITHUB_ENV_var=1
$ echo $GITHUB_ENV_var
# ❌ after set, echo nothing
$ set | grep ...
2
votes
1
answer
43
views
How do I display an alternate timezone in a zsh prompt?
I would like my zsh prompt to display the time from two time zones, specifically the local time and UTC. If I'm on PDT a display like this:
[22:21:59] [15:21:59] %
(I work with log files. Some are in ...
0
votes
1
answer
72
views
Changing default shell from zsh to bash on MacOS (Catalina and beyond) [closed]
I felt comfortable using bash shell on MacOS. But Catalina replaced it with zsh.
Why? Can I switch it back?
If so, how?
Does it make sense to do so? Any gotchas?
0
votes
0
answers
12
views
How to install `git-completion.zsh` with `zi` plugin manager
How can I install git-completion.zsh with zi plugin manager?
0
votes
1
answer
48
views
zsh: command not found: psql in mac terminal
I've got this error when I type 'psql' in my terminal : "zsh: command not found: psql".
i only got this when I open ~/.zshrc :
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions
...
0
votes
0
answers
64
views
env: bash: No such file or directory on OSX
I am using OSX terminal to run this command:
bash -l -c "! [[ -x '/path/to/example.sh' ]] && chmod +x '/path/to/example.sh'; exit 0"
/path/to/example.sh exists. Yet I am receiving ...
1
vote
1
answer
86
views
(eval):1: command not found: "export
Error on startup on terminal/iterm2
First post on stack overflow.
I keep getting this error. I've looked around the web for a fix but to no avail.
I suspect it's something related to my .zshrc file.
...
-1
votes
0
answers
25
views
zsh regex to match an exact number of digits in a file [duplicate]
For the life of me I can't figure out why this ls [0-9]{6}.txt doesn't match the file named 123456.txt. Any idea?