| LeRoy Cressy via plug on 1 Jun 2023 07:12:00 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [PLUG] zsh: command not found: |
On 5/31/23 23:19, JP Vossen via plug wrote:
> On 5/31/23 10:36 PM, Gary Duzan via plug wrote:
>>> I always do #!/bin/sh
>>> But I've seen lots of others use #!/usr/bin/env bash
>>> What's the advantage of the latter?
>>
>> It gets bash from the PATH instead of whatever specific path you
>> specify. If you have a non-standard setup, or if you want to use a
>> different version installed elsewhere, this can be a benefit. It could
>> also be a security issue if you accidentally put something insecure in
>> your PATH and you end up running a worm called "bash" from there. I've
>> seen the end trick most often with python, presumably from the days
>> when it wasn't standard equipment, so you ended up putting it in
>> /usr/local/bin or $HOME/bin or something. My NetBSD systems have it in
>> /usr/pkg/bin.
>
> What Gary said, but also don't use `sh` when you mean `bash`. That used to Just Work on Linux (but not elsewhere), but since about 2016 it's not reliable on Linux either, due to use of `dash` as `sh` instead of the much larger and thus slower `bash`.
>
> I'm torn on the hard-code vs. `env` approach. `env` is more portable, but there are possible path/poisoning issues as noted. `#!/bin/bash` is just easier to type and more familiar. :-)
>
Not all Linux distributions use /bin /sbin and other bin directories.
For instance Arch Linux uses symlinks for /bin /sbin and other bin
directories all pointing to /usr/bin. What will happen if your favorite
distribution removes the symlinks?
--
Rev. LeRoy D. Cressy
mailto:rev.cressy@prontonmail.com
/\_/\
( o.o )
> ^ <
Cell Phone: 267-668-9686
GnuPG Fingerprint:
D234 65D6 2822 211B F82F A6CA B332 4CC8 ACBF D200
Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me. (John 14:6)
You can find me on the following:
Telegram:
(My Main Channel)
https://t.me/RevLeRoy
(Send Me A Message)
https://t.me/LeRoy_Cressy
(My Videos)
https://t.me/rev_cressy_videos
Video:
ugetube.com:
https://ugetube.com/@the-rev
bitchute.com:
https://www.bitchute.com/channel/the-rev/
brighteon.com:
https://www.brighteon.com/channels/therev
rumble.com:
https://rumble.com/user/lrcressy
odysee.com:
https://odysee.com/@the-rev
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug