andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.81k stars 204 forks source link

"#!/bin/bash" -> "#!/usr/bin/env bash #881

Closed martinvahi closed 1 month ago

martinvahi commented 1 month ago

The Bash interpreter may be at different paths at different Linux/BSD/Some_other_Unix distributions. To make Bash scripts to work with all of them, the 1. line at Bash files, the one that starts with the "#!" should be

#!/usr/bin/env bash

in stead of the current

#!/bin/bash

Thank You for reading this bug report :-)

andmarti1424 commented 1 month ago

@martinvahi In what OS bash would not be in /bin/bash ? Thanks.

mipmip commented 1 month ago

@martinvahi In what OS bash would not be in /bin/bash ? Thanks.

In NixOS. Getting very popular.

mipmip commented 1 month ago

#!/usr/bin/env bash always works.

martinvahi commented 1 month ago

In what OS bash would not be in /bin/bash?

I don't know them all, but Q4OS Linux and Ubuntu at my LAN use the path of

/usr/bin/bash

They are both Debian based distros. Their "uname -a" values:

Linux terminal01 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux

Linux failiserver01 6.5.0-44-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jun 18 14:36:16 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Here's a session citation from FreeBSD console:

$ which bash
/usr/local/bin/bash
$ uname -a
FreeBSD fuajee 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64
$

There's also a Linux distributiion that is an Android application called Termux, which has Linux/GNU command line tools, but for some reason uses a BSD package manager. On Termux console the "which bash" gives

/data/data/com.termux/files/usr/bin/bash

Thank You for reading my comment :-)

andmarti1424 commented 1 month ago

@martinvahi please take note that you can for instance have which output something like this image and still have bash in both paths

andmarti1424 commented 1 month ago

Fixed with PR 888 merged on dev branch.