LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] YABO (Yet another bash oddity)

[ILUG] YABO (Yet another bash oddity)

Niall O Broin niall at magic.digiserve.ie
Tue Nov 21 12:56:53 GMT 2000


Given this little script called homedir

#!/bin/sh
echo ~$1

I expected homedir niall (or whatever) to return /home/niall (or whatever).
However, t'ain't so. A little R'ing of the FM revealed the reason to be that
tilde expansion is performed BEFORE variable expansion, and this is
apparently not negotiable. Any bash geniuses out there able to figure out a
neat way around this ? Bear in mind that what I need to do is find a user's
home directory in a script, and a little bit of awk will do it for me, so
exceedingly complex solutions don't get any cigar.


Regards,

Niall




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell