0

On systems like HP-UX or FreeBSD bash is installed in different locations, like /usr/local/bin/bash, so putting

#!/bin/bash

Will result in shell saying "script_name: not found"

Is there any workaround that would make shell script portable?

Petr
  • 13,747
  • 20
  • 89
  • 144
  • You can change shebang to `#!/usr/bin/env bash` – anubhava Oct 30 '17 at 09:47
  • The idea is to use `#!/usr/bin/env bash` if you are not sure to which path `bash` is installed to. – Inian Oct 30 '17 at 09:47
  • You may want to have a look at https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my - It may answer your question. – José Luis Oct 30 '17 at 09:48

0 Answers0