[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-apl] she bang script arguments
From: |
Xiao-Yong Jin |
Subject: |
[Bug-apl] she bang script arguments |
Date: |
Tue, 31 May 2016 23:13:12 -0500 |
Hi,
I have trouble passing arguments to script. It seems I have to add '--' to the
command line for the additional argument to be registered without apl
complaining about unknown arguments. In addition, the requirement of
'--script' makes
'/usr/bin/env’ trick (begin the file with '#!/usr/bin/env apl' to search the
path for apl and run) impossible, so I have to use a fixed path to apl for
different machines.
Is it possible to make apl behave like perl or python such that a non-option
argument passed in makes it interpret it as a script and any unknown arguments
simply passed as arguments to the script without the “unknown argument” error?
I thought I’d share my current workaround as follows. Tested on NetBSD, OS X,
Linux. Note that sh (those does not based on bash) does not like this script,
and bash does not have a standard location either.
#!/usr/bin/env bash
# -*- gnu-apl -*-
⍝ () { exec "$@" ; }
⍝ apl --script "$0" -- "$@"
]boxing 29
⎕ARG
⎕ARG↓⍨⎕ARG⍳⊂'--'
)OFF
- [Bug-apl] she bang script arguments,
Xiao-Yong Jin <=