GNU Smalltalk omits the script name in argv.
#!/usr/bin/env gst -f
| argv program |
argv := Smalltalk arguments.
(argv size) > 0 ifTrue: [
program := argv at: 1.
Transcript show: 'Program: ', program; cr.
] ifFalse: [
Transcript show: 'argv = {}'; cr.
]
$ ./scriptname.st
argv = {}
I see two ways to get the script name:
- Track down some Smalltalk method which returns the script name akin to Perl's variable
$0
. - Track down syntax for a multiline shebang and force GST to supply the scriptname as the first member of argv. Here's an example in Common Lisp.