[openbox] ~me versus /home/meme

Anthony Thyssen A.Thyssen at griffith.edu.au
Tue Aug 25 03:09:07 EDT 2009


On 25 Aug 2009 07:44:15 +0200
Johan Vromans <jvromans at squirrel.nl> wrote:

| Anthony Thyssen <A.Thyssen at griffith.edu.au> writes:
| 
| > However I have been told that the very latest version of OpenBox will
| > now only expand ~ if proceeded by a space or the start of the string.
| 
| This will stop 
| 
|   myapp --config=~/.appconfig 
| 
| from working ...
| 
Only if myapp does not itself understand '~'.  If it is allowing '~'
in its config files than it will probably handle it in the above as
well.



Normally '~' is expanded by a shell, using a VERY complex set of rules.

Bash for example will expand a '~' after a '='

   > echo config=~/.appconfig 
   config=/home/anthony/.appconfig

but not after a '/'

   > echo config/~/.appconfig 
   config/~/.appconfig

On the other hand if myapp does not expand '~' itself. Try running...
 
    myapp '--config=~/.appconfig'

to see.

Even if it doesn't there is a neat solution...

   bash -e 'myapp --config=~/.appconfig'

OR even...

   sh -e 'myapp --config=$HOME/.appconfig'

Making a '~' not expand in the current OpenBox is what is messy!


It is a complex problem, and not one OpenBox should get too involved
with.  For example does it really want to also do full quote and
backslash escape handling?  It is better for it not to do it than to do
it, as the shell is the much better tool to use if this type of thing
is needed.   The right tool for the job, so to speak (see signature).

I think tilde expansion was originally added more to allow openbox run
things like...

     ~/bin/my_openbox_app

and less for use in the middle of arguments.


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
   Shells are a tool, and we are its carpenters.
   Sometimes we need a hammer and sometimes a screwdriver.  --- John Navarra
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the openbox mailing list