I've been trying to run a simple script named 'post-install.sh':

sudo apt-get update -y

This script is in ~/bin.

Relevant commands:

% echo $PATH

My ~/.zshrc has:

export PATH=$HOME/bin:/usr/local/bin:$PATH

My ~ directory has (among others):


My /etc directory also has a zsh file but I haven't modified it. My ~/.bashrc doesn't seem to have anything relevant (I've tried adding 'source ~/.bashrc' to my .zshrc).

I'm running Debian 10 on a Thinkpad x230.

EDIT: I've tried running my script from '/usr/local/bin' as well. I've also tried running my script as:

sudo post-install.sh
sudo zsh post-install.sh

My script does run when I run the absolute path:

sudo ~/bin/post-install.sh
  • Assuming the script is executable, did you just recently (in the same shell session) move the script to its current location? If so, does rehash (in the interactive zsh session) make it available as post-install.sh?
    – Kusalananda
    Nov 17, 2020 at 13:05
  • I 'chmod' the wrong file @Kusalananda :( Solved!
    – Pexan
    Nov 17, 2020 at 14:52

1 Answer 1


I didn't mark it as executable (I did it on the wrong file) -.-

Here it is how you do it if you don't know: https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-a-termi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .