Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: How do I use 'which' in the hash-bang line?

by rizzo (Deacon)
on Mar 15, 2018 at 17:56 UTC ( #1210977=note: print w/replies, xml ) Need Help??


in reply to Re: How do I use 'which' in the hash-bang line?
in thread How do I use 'which' in the hash-bang line?

I usually use

#!/usr/bin/env perl

Is there any difference from using "which"?

From the man page of "which" I would expect exactly the same behaviour:

Which takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATH using the same algorithm as bash(1).

Update
difference is run vs. print to stdout.

Replies are listed 'Best First'.
Re^3: How do I use 'which' in the hash-bang line?
by hippo (Bishop) on Mar 15, 2018 at 18:19 UTC

    which just prints it, env runs it. Big difference.

      Thanks for your answer. Really a big difference which I a found at last( and after making the script executable ;-) Oh Lord ... ).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1210977]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-09-27 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (123 votes). Check out past polls.

    Notices?