Re: Perl/sh/bash scripts and emacs
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Sat, 29 Oct 2005 22:11:48 -0700
Marilyn Sander wrote:
>
> thank you very much for the trouble you have taken with your answer.
> I acknowlege that our script
> is not the same as the example in "Programming Perl". We really need
> to have the leading bash code there to choose what directory to execute
> Perl from. My question is still, is there a way to have that leading
> bash code and still have emacs see the file as a Perl script.
>
> I agree the documentation you've quoted does not say that it's
> possible. I just thought that the example in "Programming Perl"
> suggested there ought to be a way to do it. I've been guessing
> and trying different combinations, since there is no explicit
> rule or example. If I try
> #!/bin/bash -- # -*- perl -*- -x
>
> Perl gives the error message
> Can't emulate -x on #! line.
>
> The documentation you've quoted does not say explicitly that it's
> possible to construct this sort of script and have emacs recognize it.
> Perhaps it isn't. Do you know whether it is possible, and if so,
> how to do it?
>
> Please note, I am not an emacs user. The emacs user in question
> doesn't know how to do this, either.
I am not an emacs user either but I would assume from reading the docs that
you could do something like this:
#!/bin/bash
# shell code here
exec $perl -x $0 ${1+"$@"}
#! -*- perl -*- -w
# perl code here
__END__
something else here
John
--
use Perl;
program
fulfillment
.
- Follow-Ups:
- Re: Perl/sh/bash scripts and emacs
- From: Marilyn Sander
- Re: Perl/sh/bash scripts and emacs
- References:
- Re: Perl/sh/bash scripts and emacs
- From: John W. Krahn
- Re: Perl/sh/bash scripts and emacs
- From: Marilyn Sander
- Re: Perl/sh/bash scripts and emacs
- Prev by Date: Re: Perl/sh/bash scripts and emacs
- Next by Date: Re: Perl/sh/bash scripts and emacs
- Previous by thread: Re: Perl/sh/bash scripts and emacs
- Next by thread: Re: Perl/sh/bash scripts and emacs
- Index(es):
Relevant Pages
|