Re: [Haserl-users] /usr/bin/env and --shell=lua
Brought to you by:
nangel
|
From: Nathan A. <na...@no...> - 2007-04-30 00:39:52
|
Natanael Copa wrote: > Hi, > > I'm trying to make a portable haserl script. I develop on my freebsd laptop but the target is a linux/uclibc box. > > On the freebsd box haserl is in /usr/local/bin but on the linux it is in /usr/bin > > Normally with other scripting languages like php, you can avoid changing the #! line in all your files by using /usr/bin/env: > > #!/usr/bin/env php > > I tried to run haserl the same way: > > #!/usr/bin/env haserl --shell=lua > > but then haserl just waits for input on stdin. What you are trying to do is run haserl with command-line options: haserl --shell=lua In reality, Haserl does not accept command line arguments, for the same reason php does not accept command-line arguments in CGI mode. (see http://www.php.net/manual/en/security.cgi-bin.php the first section) What actually happens is haserl accepts only the first command-line option (the filename), it opens that file, and reads the first line for "command-line-like" arguments. > > Any ideas how to make portable haserl scripts? The real problem is that haserl masks the problem by using this command-line-like method for setting flags that probably should be done in a config file (php uses php.ini) or some other method. To solve your specific problem, haserl could be enhanced to look for the first arg that contains the phrase "haserl" - which works until someone renames the binary. :-/ What might be better if there were a smarter way of setting things like "shell", "upload limit", "upload directory", "debug mode" etc. I'm open to suggestions. |