in reply to Check for another program availability
I'd avoid reimplementing how your shell uses $PATH. If this command is being run in a wrapper, it could be as simple as a commandline argument,
If you don't know the name of the program at first, then,
$ perl ./my/script.pl $(which myprogram)
If you don't know the name of the program at first, then,
Note: which will not "find" a program in $PATH for a file where -x is not also true. In other words, which requires the "found" file to have executable permissions by the effective user. So, yeah; don't try to reimplement which.my $full_program = `which $program`; chomp $full_program;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Check for another program availability
by hrcerq (Scribe) on Apr 11, 2021 at 22:49 UTC | |
by haukex (Archbishop) on Apr 12, 2021 at 05:34 UTC | |
by perlfan (Vicar) on Apr 12, 2021 at 10:15 UTC | |
by hrcerq (Scribe) on Apr 12, 2021 at 11:55 UTC | |
by Tux (Canon) on Apr 12, 2021 at 13:50 UTC | |
by eyepopslikeamosquito (Archbishop) on Apr 12, 2021 at 23:51 UTC |
In Section
Seekers of Perl Wisdom