Re: Shebang

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

 



On Fri, Feb 08, 2019 at 04:56:12PM -0500, pmkellly@xxxxxxxxxxxx wrote:
> looks like a shebang is a way to make hard path
> reference to an executable like bash. Is this right or have I missed
> something?

You missed something.  Samuel Sieb already replied with
reference.  You may use it like

  #!/usr/bin/env bash

which will look for bash in your PATH and similar with
other interpreters.

> I thought people were trying to get hard coded paths out of their
> code.

Usually you DO NOT want to execute a program called
'bash' found somewhere instead of /bin/bash.  A script writer does not
control what will be found first in PATH.

Besides in the above you need '#!/usr/bin/env' as kernel knows nothing
about PATH.  You can more often encounter '#!/usr/bin/env python'
or something like that; this give more flexibility which 'python'
to use with trade-offs involved.


   Michal
_______________________________________________
test mailing list -- test@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to test-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/test@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]

  Powered by Linux