Skip to main content

All Questions

Tagged with
4 votes
1 answer
3k views

How to always execute a command when a shell script function finishes?

I need to write a zsh function with multiple exit points and execute the same clean-up command at every one of them: function foo { if ... ; then ... run_cleanup return ...
Petr's user avatar
  • 3,173
1 vote
2 answers
2k views

Issue with running a shell script without using 'sh' on macOS Monterey

I'm new to shell scripting and generally the usage of Terminal. I recently made a script.sh that I want to use by just typing its name without the full path. So, I wrote the path of the directory into ...
comws's user avatar
  • 13
0 votes
1 answer
456 views

Running nano from function in config file (function in zshrc) does not save changes

I am using zsh as my shell and I am trying to achieve this: In my .zshrc file I want to have a function that modifies my .zshrc, saves it and reloads it. So far I have to functions (in my .zshrc ...
idelara's user avatar
  • 101
0 votes
1 answer
153 views

Diff between files in different directories

I have the follow directory structure ./goodboys/a.txt ./goodboys/b.txt ./badboys/a.txt.boy ./badboys/b.txt.boy I am using zsh. I want to diff all *.txt in goodboys with *.txt.boy in badboys. I am ...
SurenNihalani's user avatar