6,155
questions
0
votes
1
answer
54
views
ZSH/Bash export variable from command substitution with spaces [duplicate]
I'm trying to set variables from the output of a command but bash and zsh are not respecting the quotes.
$ export $(echo 'foo=one bar="two -x"')
bash: export: `-x"': not a valid ...
-1
votes
0
answers
38
views
zsh: command not found: $ [closed]
I downloaded Homebrew but when I tried to enter "$ brew install git" I got:
zsh: command not found: $
People say to use:
export PATH =/bin:/usr/bin:/usr/local/bin:${PATH}
but I am confused ...
0
votes
0
answers
33
views
Editor Commands Hang When Running AWS Login Script in Zsh
I'm working on a script that updates an existing secret in AWS Secrets Manager. The script is written in zsh and involves several operations, including an aws_login function that handles AWS ...
-3
votes
0
answers
31
views
SDK Path Not Found on macOS: Issues with Multiple Terminals in the macos [closed]
I recently switched from a Windows system to macOS, and I'm struggling with SDK path setup and terminal commands. Initially, I used the default bash terminal, installed Android Studio, Flutter, and ...
0
votes
1
answer
27
views
Hidden directories in fzf-tab plugin
I have this line in my .zshrc file:
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color=always $realpath'
It works well. When I type "cd" command and TAB key, the shell show a list of ...
0
votes
0
answers
12
views
Creating a Custom Autocomplete Script in ZSH Around Project Root Path
I'm trying to create a script that will mimic cd where I provide a path, and the script cd's to that by appending it to an absolute existing path. The idea is that wherever I call it, it will always ...
1
vote
1
answer
45
views
Glob pattern fails to match directory name
I have two servers and my computer where I can access both of them. I made a script where the shell ask the user to input a job number. Then all I need the script to do is copy the files from one dir ...
1
vote
1
answer
97
views
Run a command whose absolute path is stored in a variable
I have a script below, which stores the absolute path of FZF in a variable named fzf_cmd. I want to execute FZF using this variable. It works in Bash but not in Zsh.
f1.sh
fun() {
local fzf_cmd
...
0
votes
1
answer
34
views
How to integrate oh-my-posh (eval "$(oh-my-posh init zsh)") into zsh profile properly
I have the following zsh profile stored under ~/.zprofile
#! /bin/zsh
eval "$(/opt/homebrew/bin/brew shellenv)"
function load_profile()
{
local tenant=$1
local subscription=$2
...
0
votes
2
answers
31
views
VS Code ignoring terminal defaultProfile settings
I'm trying to get VS Code to default to zsh but it seems intent on running bash instead.
I'm on a Mac with OS 13.6.7 installed and I'm following along with the advice in this SO thread as well as this ...
-2
votes
0
answers
32
views
Can't source another bash script when in a Python Virtualenv
I have a project that looks like so
.
├── src
│ ├── my_functions
│ │ ├── function_1.sh
│ │ └── function_2.sh
└── main-bash.sh
The main-bash.sh looks like the following
source "./src/...
0
votes
0
answers
40
views
Why is "select key" working in bash, but not in zsh?
I'm getting a bad substitution error in this bash script - pointing to the "select key in..." line.
The issues seems to be that I'm running it in a zsh shell (it runs fine in a bash shell). ...
0
votes
1
answer
28
views
Expand variable containing commands within 'osascript -e' construct
I'm attempting to write a function within zsh that takes input 1 (in this case, an arbitrary set of commands) and executes those commands in a new shell. I have the following so far:
function () { ...
0
votes
0
answers
29
views
zsh interprets command as whole string whereas bash / dash do not [duplicate]
Piece of script I need to run in various shells:
command="/sbin/traceroute -M tcp -f 255 -m 255 -q 1 -w 1 -p 80 google.fr"
result=`$command`
Result in bash and dash as expected, variable $...
2
votes
1
answer
87
views
Sanitizing PATH in case of duplicates
I have set
typeset -aU path
which helps in avoiding duplicates in my PATH. The duplicate is not added if I add it at the end to my PATH:
path+=~/bin
path+=~/foo
path+=~/bin
After this, my PATH ...
-1
votes
0
answers
75
views
How to resolve ruby version mismatch in bundler environment (using asdf)?
When running bundle install I get the following error message:
Could not find compatible versions
Because rails >= 7.2.0.beta1 depends on Ruby >= 3.1.0
and Gemfile depends on rails ~> 7.2....
-1
votes
0
answers
23
views
On mac with zsh: android device emulator is somehow on the wrong path
If I run emulator @.pixel_7_pro I get this error:
[140704653831616]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '/Users/dev/...
0
votes
1
answer
140
views
Module could be found in debug mode in VS code but could not in build-in terminal
I have created a conda environment named "pino" by:
conda create -n pino
Then, I installed the python 3.8 and pytorch in pino.
I did activate pino in the build-in terminal by
conda activate ...
0
votes
1
answer
69
views
Git sed ignore binaries [duplicate]
Similar to this user I'm having a problem running sed over all files in a repo when some of the tracked files are binaries.
Neither git ls-files nor some git-grep solutions from that question like git ...
-1
votes
2
answers
55
views
How to print to stdout the sed matches? [duplicate]
Before deleting lines with sed
sed -E -i '' '/hello/I d' myimportantfile.txt
(BSD sed)
How can I check which lines would be deleted? I thought changing the d to a p would work,
sed -E -i '' '/hello/I ...
-1
votes
2
answers
130
views
Git alias for pulling all remote branches [closed]
I'm trying to make a git alias to pull remote branches based on this answer
git branch -r \
| grep -v '\->' \
| sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" \
| while read remote; do \
...
0
votes
3
answers
63
views
How to add nvm to terminal VSCode forever
I added zsh to my terminal in VSCode and installed nvm.
But every time I open the terminal in vs code, it must re-run
source ~/.nvm/nvm.sh
If not, it will throw an error:
nvm not found and node not ...
-4
votes
1
answer
43
views
Missing the 'mysql' inside /Applications/MAMP/Library/bin/ - MAMP on MacOS Ventura
Using the free version on MAMP. Please no answers about the Pro.
It used to work a month ago. Now it doesn't work anymore, and now everytime I run mysql -u root, Terminal throws ERROR zsh: command not ...
0
votes
1
answer
26
views
zsh error setting prompt, NOT using oh-my-zsh
I am having trouble setting the dracula theme for zsh. I am NOT using oh-my-zsh.
I have downloaded the theme and I have placed it in the correct folder. When I run
~/ prompt -l
dracula adam1 adam2 ...
0
votes
4
answers
76
views
Is there a way to have fish-shell use GNU coreutils printf function?
Ran into an issue when running the following command in a fish shell:
❯ printf '%q\n' 'André Previn & London Symphony Orchestra'
%q: invalid conversion specification
I hadn't realized at first ...
-1
votes
0
answers
56
views
Can't run command after pip install in Mac OS and zshrc
I'm trying to configure a new MacBook Pro from scratch. I've installed Xcode, iTerm2, Oh My Zsh and Tmux, just to inform.
I've also set aliases for pip and python from pip3 and python3.
which python
...
-1
votes
2
answers
61
views
Error message when trying to execute a .py file in macOS terminal (zsh)
I'v got a problem.. I've installed python through HomeBrew but when i try to execute a simple hello.py file by typing python3 hello.py
it gives me this error message :
/opt/homebrew/Cellar/[email protected]/...
2
votes
0
answers
71
views
Zsh - Join after split using `s` flag
I was reading about splitting using s flag and am trying to understand the behaviour of this command I wrote.
var='axb'
var1=${(s/x/)var}
Before printing var1 I will tell what I was expecting it to ...
0
votes
1
answer
47
views
Commands not recognized when right side of pipe
Environment
OS: macOS Sonoma 14.5
Shell: ZSH 5.9
Keyboard: Danish
Problem
When piping two commands (using |) the command on the right side is not recognized. Eventhough it is a builtin command like ...
0
votes
0
answers
27
views
How do i debug issue what auto-notify plugin is not working with omz?
i have the following .zshrc
export ZSH="$HOME/.oh-my-zsh"
DISABLE_UNTRACKED_FILES_DIRTY="true"
ZSH_DISABLE_COMPFIX="true"
zstyle ':omz:update' mode auto # update ...
3
votes
1
answer
82
views
Saving $! (process ID of last background command) as an array element
I can't understand the way zsh 5.9 behaves when assigning $! to an array:
unset a b c
sleep 3 &
a=$!
b[1]=$!
c[1]=${!}
typeset -p a b c
output:
typeset a=21391
typeset -a b=( '$!' )
typeset -a ...
0
votes
1
answer
20
views
why vscode zsh's PATH is different from iterm(zsh)'s PATH
My vscode zsh's PATH is:
(base) ➜ ~ echo $PATH | tr ":" "\n"
/opt/homebrew/bin
/usr/local/bin
/System/Cryptexes/App/usr/bin
/usr/bin
/bin
/usr/sbin
/sbin
/var/run/com.apple....
1
vote
1
answer
101
views
How to get string output from multiple background child process in zsh
I am having a script which I run in zsh. Upon invoking the script, it runs the main_process() function. The main_process requires ${hash_from_evaluator} for rest of its operation, however calculating ...
-1
votes
1
answer
44
views
I wrote deactivate() instead of deactivate at the terminal prompt. How do I get back? [closed]
I wanted to deactivate virtual environment by command deactivate but accidentally wrote deactivate(). It then opened console with
function>
I typed some symbols and now, when I call command ...
2
votes
2
answers
112
views
zsh glob to find directories that are empty or that only contain a .DS_Store
Is there any zsh glob that will find directories that are either empty or that only contain a .DS_Store file?
I know that the (/^F) glob flag combo will find empty directories, but I also want to ...
1
vote
0
answers
17
views
How to get hash of newly rebased commit in Mercurial
I'm trying to write an alias for mercurial that will reabse a commit with HashA, and then hg up to the newly rebased commit.
My problem is I don't know how to programatically get the new commit hash. ...
0
votes
2
answers
81
views
How do I use aliases in the "sh -c" command? [duplicate]
I tried "sh -c [some alias]" but that didn't work, whereas running it directly was fine
~/.bashrc:
alias ll=" ls -alF "
There is the same problem in zsh, and technically I mainly ...
0
votes
3
answers
78
views
zsh: no matches found: MultiplicateLists(np.array([1,3,5,6,4,6,7,1,2,7]))
I would like to import a list in a python function and run the function from the terminal of Visual Studio Code. My function, that I called "MyFunction.py", and that I temporarily saved on ...
0
votes
1
answer
103
views
Compiling VHDL file with ```ghdl -a``` encountered error ```ghdl:error: installation problem: ghdl1-llvm not found```
I was recently trying to compile the .vhd file with ghdl ghdl -a --ieee=synopsys --work=work Matrix_Data_Structure.vhd , the following error occurred :
ghdl:error: installation problem: ghdl1-llvm ...
0
votes
1
answer
49
views
Why are there multiple python versions available via homebrew, and how do they relate to package Installation?
I had a problem, which took me way too long to solve. Basically I coudn't import tkinter and kept getting
import _tkinter # If this fails your Python may not be configured for Tk
I finally found the ...
2
votes
2
answers
134
views
Manjaro zsh python-argcomplete error after update
After recently updating my system after a while I noticed my zsh terminal wasn't working properly. When I try tab completing it gave
(eval):1: _python-argcomplete: function definition file not found
(...
0
votes
0
answers
31
views
Why can I not import from `npm`'s global libraries?
My shell is zsh (which I recently switched to and am still learning) and I am trying to create the following alias:
alias bip39="echo \"import('bip39').then((bip) => bip.generateMnemonic()...
-1
votes
1
answer
54
views
How to run multiple commands in a for loop writhin in one line in zsh (or bash)
Let's say I want to run multiple command in a for loop writhin in one line in zsh (in that case, print the item name within a directory and print it
for i in *; echo "=================="; ...
-1
votes
1
answer
33
views
Calling `subprocess` in Python notebook has different `$PATH` than `!` shell
I am developing a wrapper class interactively in an IPython notebook. This wrapper class invokes a command line program written in java, and thus I need access to the same version of the java runtime ...
0
votes
0
answers
28
views
zsh terminal: scripts that are available on the path, are not suggested by autocomplete
I've placed several scripts at: ~/bin/scripts.
when in bash, if I place the script there, and put the location in the path, I can type out half the script name and hit tab, and the rest of the script ...
0
votes
0
answers
50
views
zsh: how to pass =() to curl
Similar to how <(list) process substitution can be used in
curl -XPOST example.com/foo -F file=@<(<<<data)
how can I use =(list) process substitution in the same command?
I tried
curl -...
0
votes
1
answer
90
views
zsh case-insensitive completion match not working
Problem
I've recently made some changes to my terminal development tools. Everything has been working as expected, except for case-insensitive match completion, which before it would match completions ...
0
votes
1
answer
122
views
how to use custom preview function for fzf command on zsh
foo() {
echo "bar"
}
export -f foo
fzf --preview "foo"
leads to opened preview window and error msg:
zsh:1: command not found: foo
How can I define my custom function that ...
0
votes
0
answers
29
views
Conda Virtual Environment Display Issue in Terminal Prompt ~ZSH
I'm experiencing a display issue with my Conda virtual environment in the terminal . The environment name that is rendered strangely on the right side of each line is not correct i expect to show base ...
0
votes
0
answers
42
views
zsh auto complete not completing for macOS 'defaults' command
I have enabled zsh-completions using zinit and however when attempting to use completions with the 'defaults' command such as defaults write com.apple.screencapture location /path/to/ it seems to fail ...