Command Line Behavior
Posted: Thu Aug 07, 2008 11:11 pm
According to the manual, newLISP will attempt to load files listed on the command line. Is there any way to control this behavior with a flag? I would like to prevent it.
I am sure it is often helpful to have this convenience, but when you want to pass a string as an argument that happens to be the name of a file in the directory it can pose a problem.
For example:
--
Moonrise:Documents jd$
Moonrise:Documents jd$ newlisp list_categories.php
ERR: invalid function : (Admin)
Moonrise:Documents jd$
--
This file is not executable from the command line. Even if one sets the permissions to allow it to be executable it will generate errors.
The other issue here is that this command line behavior is inconsistent. Consider this file:
--
Moonrise:Documents jd$ cat john
#!/bin/sh
echo "johnjohnjohn"
Moonrise:Documents jd$
--
Simple enough. Echo the string to the terminal. This executable file name is treated as a string by newLISP but not executed.
--
Moonrise:Documents jd$ newlisp "john"
newLISP v.9.4.3 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.
> (main-args)
("newlisp" "john")
>
--
It seems to me that what newLISP considers "a file on the command line" should depend more on a flag setting or on the format of the argument (e.g. "file://..." or something similar) than the contingent contents of the directory.
Thanks,
John[/i]
I am sure it is often helpful to have this convenience, but when you want to pass a string as an argument that happens to be the name of a file in the directory it can pose a problem.
For example:
--
Moonrise:Documents jd$
Moonrise:Documents jd$ newlisp list_categories.php
ERR: invalid function : (Admin)
Moonrise:Documents jd$
--
This file is not executable from the command line. Even if one sets the permissions to allow it to be executable it will generate errors.
The other issue here is that this command line behavior is inconsistent. Consider this file:
--
Moonrise:Documents jd$ cat john
#!/bin/sh
echo "johnjohnjohn"
Moonrise:Documents jd$
--
Simple enough. Echo the string to the terminal. This executable file name is treated as a string by newLISP but not executed.
--
Moonrise:Documents jd$ newlisp "john"
newLISP v.9.4.3 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.
> (main-args)
("newlisp" "john")
>
--
It seems to me that what newLISP considers "a file on the command line" should depend more on a flag setting or on the format of the argument (e.g. "file://..." or something similar) than the contingent contents of the directory.
Thanks,
John[/i]