Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Chicken Scheme have an equivalent to Perl's $0?

How can I reliably get the script name in Chicken Scheme?

It seems that -ss eats up the script name, so it's not visible unless I use dot slash to run my scripts.

scriptedmain.scm:

#!/usr/bin/env csi -q

(display (command-line-arguments))
(display "\n")
(exit)

Trace:

$ ./scriptedmain.scm 
(-q ./scriptedmain.scm)
wonko:Desktop andrew$ csi -ss scriptedmain.scm 
()
like image 439
mcandre Avatar asked Mar 04 '11 00:03

mcandre


1 Answers

This is a late response, so may not be of use to the original poster. But to any others who may come across this question, the simple answer is to use the parameter:

(program-name)

This should return the correct name for all situations. Docs here.

like image 142
Imran Rafique Avatar answered Nov 15 '22 09:11

Imran Rafique