on the other hand, I would be happy if `command $var` (including `exec command $var args...`) was allowed. Because that makes clear that you're not going to let arbitrary vars call into the shell internal stuff by accident like that (or is there ever a real use case for that?? crazy shell scripting? what is the scope of functions you define, anyway?) That seems reasonable to put in the message as "if necessary".
(p.s. why is "command" a builtin when it doesn't really need to be :-P ? oh.. so no one can make a function with that name by accident, maybe? and because it's virtually no implementation effort anyway) Isaac Dupree wrote: > well, there's `eval`, but it doesn't do what you want: it doesn't exec > and if you gave it any arguments with $ in them, it would interpolate > them again. `exec eval ...` gives "fish: Unknown command “eval”". Why > may not variables be used as commands? Did the maker of this rule > forget that it may be *necessary* for random access? Hmm, `env $var` > works, and so does `exec env $var`, but it seems like a total hack to > me. (at the very least, the error message needs to tell you that's > possible -- ideally perhaps the message would be different depending if > the argument value was originally assigned to a constant versus an open > expression like (dmenu_path | dmenu)). > > -Isaac > > Piotr Husiatyński wrote: >> hi, >> I'm just switching to fish from bash and rewriting my configuration files. >> One >> of the command is >> >> var=$(dmenu_path | dmenu); exec $var >> >> so I rewrite it to >> >> set var (dmenu_path | dmenu); exec $var >> >> but it returns me an error: >> >> ~> set var (dmenu_path | dmenu); exec $var >> fish: Variables may not be used as commands. Instead, define a function >> like 'function var; xterm $argv; end'. See the help section for the >> function command by typing 'help function'. >> >> >> > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Fish-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/fish-users ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
