Gary Duzan via plug on 31 May 2023 19:36:12 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] zsh: command not found:


>
> 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.

                              Gary Duzan


>
> Thanks,
>
> SteveT
>
> Steve Litt
> Autumn 2022 featured book: Thriving in Tough Times
> http://www.troubleshooters.com/bookstore/thrive.htm


___________________________________________________________________________
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