Stupid bash scripting question

Kenneth E. Lussier klussier at sentito.com
Wed Aug 24 10:47:01 EDT 2005


On Wed, 2005-08-24 at 10:32 -0400, Cole Tuininga wrote:
> I've received two different responses to this request - both of which
> seem to work just fine.  My thanks to those who responded.  I'm a little
> curious if one solution has any advantages over the other:
> 
> Solution 1:
> 
> user="username"
> f=`eval "echo ~${user}"`
> 
> 
> Solution 2:
> 
> user="username"
> f=`getent passwd $user|cut -f6 -d:`
> 
> 
> It seems that either will do the job, I'm just wondering (for the
> purpose of my own "betterment" and improved knowledge of shell scripting
> *grin*) about advantages of either approach.  The only one I've come
> with so far is that Solution 2 requires a separate process to run.

The first method is less typing :-)

-- 
Kenneth E. Lussier 
Sentito Networks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20050824/077104f1/attachment.bin


More information about the gnhlug-discuss mailing list