Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!ispi!jbayer From: jbayer@ispi.UUCP (Jonathan Bayer) Newsgroups: comp.unix.wizards Subject: awk and shell question Keywords: awk sh Message-ID: <1163@ispi.UUCP> Date: 16 Sep 89 13:43:16 GMT Organization: Intelligent Software Products, Inc. Lines: 52 HELP!! I have been pulling my hair out over this seemingly simple problem: I have to get the user id, and then get the user description from /etc/passwd. Now, getting the user id was easy. The script is below: LOGNAME=`who am i | awk '{ logname=$1 print logname }'` LOGNAME is set nicely here. However, when I try to do something similar to /etc/passwd as follows: a=" awk -F: '\$1 == \"$LOGNAME\" { user=\$5; print user }'" USER=`cat /etc/passwd | $a` I get the following error: awk: syntax error at source line 1 context is >>> ' <<< awk: bailing out at source line 1 Now, the following line does work (when I hardcode in LOGNAME): USER=`cat /etc/passwd | awk -F: '$1 == "root" { user=$5; print user }'` So my question is, what am I doing wrong here? I am not that fluent in awk, so this doesn't make too much sense right now. This is running on an SCO Xenix 386, 2.3.3 system. JB -- Jonathan Bayer Intelligent Software Products, Inc. (201) 245-5922 500 Oakwood Ave. jbayer@ispi.COM Roselle Park, NJ 07204