help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] shebang for language that does not use # for comment


From: Eric Blake
Subject: Re: [Help-bash] shebang for language that does not use # for comment
Date: Tue, 03 Jul 2012 17:17:29 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 07/03/2012 05:01 PM, Bob Proulx wrote:
> Peng Yu wrote:
>> For languages that do not use # as commend symbol, I have some trouble
>> for using the shebang line (see the annoy error message).
> 
> If the interpreter does not use '#' for comments then using the
> shebang line ('#!') to launch it is unsuitable.  You should find a
> different method for invoking it.

For example, instead of attempting:
====
#!/usr/bin/env gp

\p 212
(1.378-0.09143*I)^(14.87+0.3721*I)
====

you could instead use:
====
#!/bin/sh
exec /usr/bin/env gp <<\EOF

\p 212
(1.378-0.09143*I)^(14.87+0.3721*I)
EOF
====

and if you don't like putting the EOF at the end, you could use hacks like:
====
#!/bin/bash
shopt -s lastpipe; tail -n +2 "$0" | exec /usr/bin/env gp

\p 212
(1.378-0.09143*I)^(14.87+0.3721*I)
====

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]