Portable line shebang

#!/usr/bin/perl

This is a shebang line for a lot of the scripts I have been writing lately.

Hard coding the binary path seems like it can create some problems. For example, if one of my users has Perl installed in / something _else / bin, then they will have to change all shebangs.

I saw some tools that automatically replace shebangs, but I am wondering if there is anything simpler.

+3
source share
2 answers

env(1)

#!/usr/bin/env perl
+11
source

, env /usr/bin/env (, NAS funplug ..), . ActivePerl/DOS

#!/bin/sh
exec perl -x -S "$0" "$@"
#!perl
print "hello";
+1

Source: https://habr.com/ru/post/1745709/


All Articles