[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] strange behavior of --
From: |
enztec |
Subject: |
Re: [Bug-apl] strange behavior of -- |
Date: |
Sun, 5 Feb 2017 15:11:23 -0700 |
do you have an example of what you mean by 'used in this way'?
with the recent '--' change - the apl scripting seems to behave the same as
would be done with python/php
On Sun, 05 Feb 2017 21:08:40 +0100
Alexey Veretennikov <address@hidden> wrote:
> Hi,
>
> It looks like other interpreters (not APL, but other languages: perl,
> python, awk etc) have some other behavior concerning command line
> arguments.
> With python I can just specify
> #!/usr/bin/python
only difference is adding '--script --' apl interpreter options to shebang
line
you can add options to the python shebang too - each interpreter handles it's
shebang line parameters differently
http://stackoverflow.com/questions/17354951/why-wont-the-python-shebang-take-more-than-three-parameters
>
> and the script will pick-up all arguments an ordinary program,
> regardless of the platform; while just running say "python" will give me
> the normal interpreter.
running just 'apl' gives you the interpreter
>
> I don't know how others think, but I could imagine GNU APL could be much
> more useful as a scripting language if it could be used in this way.
> Right now because of this behavior it is not really convenient (for me).
give an example please
>
> What do you (and others) think?
>
> Juergen Sauermann <address@hidden> writes:
>
> > Hi,
> >
> > yes, most of this trouble is caused by how execve() works, which is quite
> > different
> > on different platforms. And it happens before apl is being called so I cant
> > do much
> > about it.
> >
> > Sometimes it helps to start apl with -f so that the interpreter knows where
> > to fetch
> > its input, like:
> >
> > #!/usr/local/bin/apl -f /home/eedjsa/tmp/script --script --
> >
> > /// Jürgen
> >
> > On 02/04/2017 02:00 PM, Alexey Veretennikov wrote:
> >
> > Hi Juergen,
> >
> > Something is apparently strange on OSX(?). With the latest version
> > when I run the same script below I get the silent input without
> > echoing, no output like below, and I have to blindly type )off manually
> > to exit interpreter.
> >
> >
> > Juergen Sauermann <address@hidden> writes:
> >
> > Hi Alexey,
> >
> > I have changed the handling of command line options, SVN 877.
> >
> > It now works like this:
> >
> > script:
> >
> > #!/usr/local/bin/apl --script --
> >
> > )copy 5 FILE_IO FIO∆errno
> > 8⎕CR ⎕ARG
> > )off
> >
> > output:
> >
> > address@hidden:~/tmp$ ./script scriptarg
> > DUMPED 2017-01-28 22:57:44 (GMT+1)
> > ┌→──────────────────────────────────────────────────────────┐
> >
> > │┌→─────────────────┐ ┌→───────┐ ┌→─┐ ┌→───────┐
> > ┌→────────┐│
> > ││/usr/local/bin/apl│ │--script│ │--│ │./script│ │scriptarg││
> > │└──────────────────┘ └────────┘ └──┘ └────────┘
> > └─────────┘│
> > └∊──────────────────────────────────────────────────────────┘
> >
> >
> > /// Jürgen
> >
> > On 02/03/2017 11:06 PM, Alexey Veretennikov wrote:
> >
> > Hi,
> >
> > Yes ./script -- myarg works.
> >
> > The problem is why I have to repeat -- in command line since I've
> > already specified it in the first line of the script, as it is specified
> > in documentiation.
> >
> > Basically I would like to pass my arguments to the script without
> > mentioning "--" in the command line.
> >
> > Juergen Sauermann <address@hidden> writes:
> >
> > Hi Alexey,
> >
> > how about this:
> >
> > address@hidden:~/tmp$ ./script -- arg**
> > **DUMPED 2017-01-28 22:57:44 (GMT+1)**
> > **┌→────────────────────────────────────────────────────┐**
> > **│┌→─────────────────┐ ┌→───────┐ ┌→───────┐ ┌→─┐ ┌→──┐│**
> > **││/usr/local/bin/apl│ │--script│ │./script│ │--│ │arg││**
> > **│└──────────────────┘ └────────┘ └────────┘ └──┘ └───┘│**
> > **└∊────────────────────────────────────────────────────┘*
> >
> > There is no point (and it does not work) to put the arguments in the first
> > line
> > of the script,
> > because if the script itself knows them then the rest of the script can use
> > them
> > as well.
> >
> > *⎕ARG *is what is passed to the script, not what is passed to the
> > interpreter
> > mentioned in the script.
> > See also *man execve*.
> >
> > /// Jürgen
> >
> >
> > On 02/03/2017 08:29 PM, Alexey Veretennikov wrote:
> >
> > Given the following script:
> > ------------------------------------------
> > #!apl --script --
> > )copy 5 FILE_IO FIO∆errno
> > 8⎕CR ⎕ARG
> > )off
> > ------------------------------------------
> > when I try to run it like
> >
> > ./script.apl myarg
> >
> > I get the error:
> >
> > /script.apl myarg
> > unknown option 'myarg'
> > ...
> >
> > This happens on 833 and 1.5 and on both linux and osx.
> >
> > In INFO file it explicitely states:
> >
> > "Using ’—-’ as last argument on the first line of the script file
> > prevents any of the options given to the script to be interpreted as APL
> > options; all such options are passed to the application via ⎕ARG."
> >
> > But it is not happening.
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> Br,
> /Alexey
>
- [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/03
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/03
- Re: [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/03
- Re: [Bug-apl] strange behavior of --, enztec, 2017/02/03
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/04
- Re: [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/04
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/04
- Re: [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/05
- Re: [Bug-apl] strange behavior of --,
enztec <=
- Re: [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/05
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Alexey Veretennikov, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Xiao-Yong Jin, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Juergen Sauermann, 2017/02/06
- Re: [Bug-apl] strange behavior of --, Xiao-Yong Jin, 2017/02/06