Google Groups Home
Help | Sign in
/bin/env standard location?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Martin Ramsch  
View profile  
 More options Oct 14 1999, 3:00 am
Newsgroups: comp.unix.shell
From: m.ram...@computer.org (Martin Ramsch)
Date: 1999/10/14
Subject: /bin/env standard location?
Hi all,

I wonder if there is a standard location for the env command that is
the same in all or as many as possible flavours of Unix (SysV style,
BSD style, SunOs, Solaris, Linux ...)?

Should  /bin/env  always exist?

Or are there systems that don't even have the env command at all?

Motivation:

I'd like to start my perl scripts using

  #! /bin/env perl

because this way the perl interpreter should be searched in the
current command PATH and I don't have to hard-code the path to the
perl binary.

Regards,
  Martin
--
Martin Ramsch <m.ram...@computer.org> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=5244 5EF3 B0B1 3826  E4EC 8058 7B31 3AD7


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Weisgerber  
View profile  
 More options Oct 14 1999, 3:00 am
Newsgroups: comp.unix.shell
From: na...@mips.rhein-neckar.de (Christian Weisgerber)
Date: 1999/10/14
Subject: Re: /bin/env standard location?

Martin Ramsch <m.ram...@computer.org> wrote:
> I wonder if there is a standard location for the env command that is
> the same in all or as many as possible flavours of Unix (SysV style,
> BSD style, SunOs, Solaris, Linux ...)?

> Should  /bin/env  always exist?

FreeBSD:       /usr/bin/env
Red Hat Linux: /usr/bin/env

--
Christian "naddy" Weisgerber                  na...@mips.rhein-neckar.de


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Moore  
View profile  
 More options Oct 14 1999, 3:00 am
Newsgroups: comp.unix.shell
From: jmo...@rios85.sdrc.com (Joe Moore)
Date: 1999/10/14
Subject: Re: /bin/env standard location?
In article <slrn80bk3o.4fr.m.ram...@melian.forwiss.uni-passau.de>,

Martin Ramsch <m.ram...@computer.org> wrote:

>Motivation:

>I'd like to start my perl scripts using

>  #! /bin/env perl

>because this way the perl interpreter should be searched in the
>current command PATH and I don't have to hard-code the path to the
>perl binary.

On most systems, either /bin is a link to /usr/bin, or it has a /bin/env.

However,

I don't think that would work.  When the kernel executes the script (via
the #! feature) it uses the argument as the program to execute. (and I think
the name of the file as the last command line arguemnt.

So you would effectively be running "/bin/env perl foo.pl" which I don't
think would do what you want.

There might be a way to do it... by
untested:#!/bin/sh -c eval `/bin/env perl`
But I doubt it -- You might only be allowed one option.  It'd be better to
install a link to perl in some standard path and refer to that.

Check for the link during installation, and update the path if neccessary.

--Joe
--
IBM's vision is apparently to make IBM hardware "scream with Microsoft
software" --The Register, http://www.theregister.co.uk/990927-000003.html

I have visions of screaming with (at and about) Microsoft software, too.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Weisgerber  
View profile  
 More options Oct 15 1999, 3:00 am
Newsgroups: comp.unix.shell
From: na...@mips.rhein-neckar.de (Christian Weisgerber)
Date: 1999/10/15
Subject: Re: /bin/env standard location?

Joe Moore <jmo...@rios85.sdrc.com> wrote:
> On most systems, either /bin is a link to /usr/bin, or it has a /bin/env.

Rather: ... or it has /usr/bin/env.

> So you would effectively be running "/bin/env perl foo.pl" which I don't
> think would do what you want.

Yes, it does. Clever idea, actually.

--
Christian "naddy" Weisgerber                  na...@mips.rhein-neckar.de


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Owen M. Astley  
View profile  
 More options Oct 15 1999, 3:00 am
Newsgroups: comp.unix.shell
From: "Owen M. Astley" <oma1...@cam.ac.uk>
Date: 1999/10/15
Subject: Re: /bin/env standard location?
Attributed to Martin Ramsch <m.ram...@computer.org>:

> Should  /bin/env  always exist?

> Motivation:

> I'd like to start my perl scripts using

>   #! /bin/env perl

> because this way the perl interpreter should be searched in the
> current command PATH and I don't have to hard-code the path to the
> perl binary.

Neat idea.  Another idea appears to be (snipped from the top of weblint):

: # use perl                                  -*- mode: Perl; -*-
        eval 'exec perl -S $0 "$@"'
                if $runnning_under_some_shell;

Owen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Wooding  
View profile  
 More options Oct 19 1999, 3:00 am
Newsgroups: comp.unix.shell
From: m...@catbert.ebi.ac.uk (Mark Wooding)
Date: 1999/10/19
Subject: Re: /bin/env standard location?

Martin Ramsch <m.ram...@computer.org> wrote:
> Christian Weisgerber wrote that both FreeBSD and Red Hat Linux have
> /usr/bin/env,

Neither FreeBSD nor Redhat has /bin/env.  Debian GNU/Linux also has
/usr/bin/env and not /bin/env.  However, note that Solaris, Digital Unix
and IRIX at least have both /bin/env and /usr/bin/env.  Digital Unix
also appears to have /usr/ucb/env for some reason, and IRIX has
/sbin/env.  

> My current impression is that I should use /bin/env ...

I think the available evidence suggests that:

  * /bin/env doesn't work;
  * /usr/bin/env seems to work on most platforms; and
  * Autoconf is a better solution to this problem.

-- [mdw]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Ramsch  
View profile  
 More options Oct 23 1999, 3:00 am
Newsgroups: comp.unix.shell
From: m.ram...@computer.org (Martin Ramsch)
Date: 1999/10/23
Subject: Re: /bin/env standard location?
On 19 Oct 1999 10:28:48 GMT,

Mark Wooding <m...@catbert.ebi.ac.uk> wrote:
>I think the available evidence suggests that:

>  * /bin/env doesn't work;
>  * /usr/bin/env seems to work on most platforms; and
>  * Autoconf is a better solution to this problem.

Mark, I think this is a good summary!  Thanks to you and all others
who have answered in this thread!

Regards,
  Martin
--
Martin Ramsch <m.ram...@computer.org> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=5244 5EF3 B0B1 3826  E4EC 8058 7B31 3AD7


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google