Stupid bash scripting question

Cole Tuininga colet at code-energy.com
Wed Aug 24 10:33:00 EDT 2005


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.

-- 
"Things are fine, the upcoming semester approaches like a brick wall
 and we're in a 1962 Corvair with no brakes."  - Paul Sand

Cole Tuininga
Lead Developer
Code Energy, Inc
colet at code-energy.com
PGP Key ID: 0x43E5755D





More information about the gnhlug-discuss mailing list