Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: using #! for perl scripts Message-ID: <1991May17.172744.21380@convex.com> Date: 17 May 91 17:27:44 GMT References: Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: comp Organization: CONVEX Software Development, Richardson, TX Lines: 31 Nntp-Posting-Host: pixel.convex.com From the keyboard of rusty@groan.Berkeley.EDU (Rusty Wright): :The man page for execve says that the pathname given after the #! can :be at most 32 characters. But the full pathname of perl on my machine :is more than 32 characters. Does anybody have recommendations on a :good consistent way to deal with this? You can make sh start it, then exec your own perl: #!/bin/sh # need to mention perl here to avoid recursion # # # NOTE: # If you know where perl is and your system groks #!, put its # pathname at the top to make this a tad faster. # # The following magic is from the perl man page # and should work to get us to run with perl # even if invoked as an sh or csh or foosh script. # Notice we don't use full path 'cause we don't # know where the user has put perl on their system. # eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if $running_under_some_stupid_shell_instead_of_perl; --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "So much mail, so little time."