开发者

path in shebang

开发者 https://www.devze.com 2023-02-19 23:12 出处:网络
I have /bin/bash (3.2) and /usr/local/bin/bash (4.0) on my computer. In the $PATH environment variable, bash 4.0 is prior to bash 3.2.

I have /bin/bash (3.2) and /usr/local/bin/bash (4.0) on my computer. In the $PATH environment variable, bash 4.0 is prior to bash 3.2.

in my bash script shebang, I don't like to explicitly use:

#!/usr/local/bin/bash
开发者_如何学运维

I'd like to find bash based on $PATH priority. How to do it? Thanks!


you can always try

#!/usr/bin/env bash
0

精彩评论

暂无评论...
验证码 换一张
取 消