0

If I run export PATH=$PATH:/home/mike/bin/*:/home/mike/app/* from a command line it works fine, but if I put it into a bash script, it doesn't work (even with a restart). I have also tried including double-quotes and curly brackets for the variables.

  • Hello, try export PATH=$PATH:/home/mike/bin/:/home/mike/app/ without wildcards *. – pa4080 Jan 25 '19 at 08:32
  • 3
    What do you want to achieve? Have these folders permanently in your PATH for all your shell sessions? https://askubuntu.com/questions/3744/how-do-i-modify-my-path-so-that-the-changes-are-available-in-every-terminal-sess - Or do you want to run the script and then have PATh changed in your current session? That doesn't work because scripts run in subshells and can not alter the parent environment. You will have to source the script instead for that to happen. - Besides, I think you should not have the * globs there in the PATH string. You only need the directory itself listed there, no file – Byte Commander Jan 25 '19 at 09:19

1 Answers1

0

You should only add path in this environnement in this variable. Change your script to use the following command

export PATH="$PATH:/home/mike/bin/:/home/mike/app/"
ob2
  • 3,553