Stupid bash scripting question

John Abreau jabr at blu.org
Wed Aug 24 17:44:01 EDT 2005


On Wed, 24 Aug 2005, Cole Tuininga wrote:

> 
> Ok - I'm sure the answer to this is simple, but I can't seem to figure
> the darned thing out.  In my defense, it's extremely rare that I do any
> shell scripting.  8)
> 
> Basically, the deal is that I have a variable that contains a string
> such as "~username".  I'd like to actually expand that to the user's
> home directory.

How about

    eval "echo ~$user"

or

    FOO=$(eval "echo ~$user")

-- 
John Abreau / Executive Director, Boston Linux & Unix
ICQ 28611923 / AIM abreauj / JABBER jabr at jabber.org / YAHOO abreauj
Email jabr at blu.org / WWW http://www.abreau.net / PGP-Key-ID 0xD5C7B5D9
PGP-Key-Fingerprint 72 FB 39 4F 3C 3B D6 5B E0 C8 5A 6E F1 2C BE 99




More information about the gnhlug-discuss mailing list