Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1 votes
1 answer
265 views

Can a bash script add to the context of zsh?

I have recently migrated from bash to zsh. I used to use the following token_refresh.sh script to ssh-add my private key to the session: #!/usr/bin/env bash echo "configuring ssh access.." ...
StuperUser's user avatar
10 votes
6 answers
4k views

Portable check empty directory

With Bash and Dash, you can check for an empty directory using just the shell (ignore dotfiles to keep things simple): set * if [ -e "$1" ] then echo 'not empty' else echo 'empty' fi However I ...
user avatar
59 votes
7 answers
45k views

Unix-portable way to get script's absolute path in zsh?

What is a portable1 way for a (zsh) script to determine its absolute path? On Linux I use something like mypath=$(readlink -f $0) ...but this is not portable. (E.g., readlink on darwin does not ...
kjo's user avatar
  • 16k
36 votes
5 answers
51k views

Is it recommended to use zsh instead of bash scripts? [closed]

Can I assume that enough people have zsh installed to run scripts with a #!/usr/bin/env zsh as shebang? Or will this make my scripts un-runnable on too many systems? Clarification: I’m interested ...
Profpatsch's user avatar
  • 1,829