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: Peng Yu
Subject: Re: [Help-bash] shebang for language that does not use # for comment
Date: Tue, 3 Jul 2012 19:27:07 -0500

On Tue, Jul 3, 2012 at 7:14 PM, Peng Yu <address@hidden> wrote:
>> 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)
>> ====

This seems not working. Is there anything wrong?

~/linux/test/gnu/bash/man/builtin/shopt/lastpipe$  ./main1.sh
                  GP/PARI CALCULATOR Version 2.5.1 (released)
          i386 running darwin (x86-64/GMP-5.0.4 kernel) 64-bit version
        compiled: Jul  3 2012, gcc-4.2.1 (Apple Inc. build 5666) (dot 3)
                (readline v6.2 disabled, extended help enabled)

                     Copyright (C) 2000-2011 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 8000000, primelimit = 500509
  ***   unused characters: shopt-slastpipe;tail-n+2"$0"|exec/usr/bin/en
  ***                                              ^--------------------
   realprecision = 231 significant digits (212 digits displayed)
%1 = 
80.817082637557070449383034933010288336925078193546211741027496566803185110925792657439929206283145167399627244460426678862453227164569661204139651873272488827365261487845201056199035423784093096984005713791800191
- 
94.838461889186304973351271821601500916571303364865064205039706592481303045713982306764332644305117525157057688587100513820353771954974829340172391797575388246887990680136241031895212412150770309289450962931402933*I
Goodbye!
~/linux/test/gnu/bash/man/builtin/shopt/lastpipe$ cat main1.sh
#!/usr/bin/env 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)




> I never knew lastpipe this before. But I'm having difficulty in
> understanding the following description. Could anybody elaborate it a
> bit? In the context of the above example, how it works?
>
>               lastpipe
>                       If set, and job control is not active, the shell
> runs the last command of a pipeline not executed in the background in
> the current shell environment.
>
> BTW, how "job control" can be nonactive?
>
> --
> Regards,
> Peng



-- 
Regards,
Peng



reply via email to

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