Re: command_line() with *

new topic     » goto parent     » topic index » view thread      » older message » newer message

Others are correct. The unix shell expands * itself, it has nothing to do with Euphoria. A simple C program has the same effect:

#include <stdio.h> 
 
int main(int argc, char **argv) { 
        int i; 
        for (i=0; i<argc; i++) 
                printf("%d = %s\n", i, argv[i]); 
        return 0; 
} 

To get around this, the only way is to escape the * on the command line, which isn't very user friendly:

$ calc 10 \* 20 

Now, one other alternative is you may want to split things inside of Euphoria itself. For instance, take an expression on the command line:

-- Run with: 
--   $ calc.ex "10 * 20" 
-- 
 
include std/sequence.e 
 
sequence args = command_line() 
for i = 3 to length(args) do 
    sequence expr_args = split(args[i]) 
    -- expr_args = { "10", "*", "20" } 
end for 

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu