Panel can't do shell expansion?

Jaap Karssenberg j.g.karssenberg at student.utwente.nl
Tue Feb 15 19:32:14 CET 2005


David Olbersen wrote  on 02/15/2005 06:27 PM:
> Am I alone in the expectation that what I type in the Command field of a 
> launcher should work as though it were a shell command?

Well, yes, I hope so.
Almost any program I know of that allows you to configure a command 
string just passes it to execvp() which does little more than searching 
$PATH. There is a good reason for that; shell parsers are quite 
complicated and it would be overhead to have a shell interpreter 
embedded in your program just so a user can have shell expansion.
This is the reason that the "#!" for shell scripts was invented. Shell 
scripts allow you to have a shell expansions, redirections etc. etc. and 
can be called from your execvp() as a command. In fact even if your file 
isn't executable execvp() will still try to run it as a shell script.

So your options are either inlining a "sh -c", as other posters 
suggested, or make a shell script containing the expansion logic.
As a bonus you are allowed to choose for yourself which shell- or 
script-interpreter you use.

Note that the "exec" command in script languages like bash or perl uses 
the execvp() system call internally.

-- 
    )   (     Jaap Karssenberg || Pardus [Larus]                | |0| |
    :   :     http://pardus-larus.student.utwente.nl/~pardus    | | |0|
  )  \ /  (                                                     |0|0|0|
  ",.*'*.,"   Proud owner of "Perl6 Essentials" 1st edition :)  wannabe



More information about the Xfce mailing list