Variable for User Comment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Variable for User Comment
# 1  
Old 03-09-2007
Variable for User Comment

SCO 5.06

Is there a variable that holds a user's comment?
In scoadmin -account, there's a comment field which we normally
populate with the user's name.

Or ... am I better off greping /etc/passwd?

Thanks!
# 2  
Old 03-09-2007
I have never seen a variable like that. But try awk rather than grep:
awk -F: '$1 == "'$USER'" { print $5}' < /etc/passwd

Cut and paste to be you get the quoting right.
# 3  
Old 03-09-2007
Quote:
Originally Posted by Perderabo
I have never seen a variable like that. But try awk rather than grep:
awk -F: '$1 == "'$USER'" { print $5}' < /etc/passwd

Cut and paste to be you get the quoting right.

I kinda thought that too, but I gave it a shot ... Smilie

Thanks Perderabo ... that works beautifully.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to get user environment variable for smf daemon?

I am new to smf...I am trying to create new smf service and starting a Python daemon script. The python daemon script will call few other scripts internally as subprocess. The scripts which are called by daemon are unknown of user environment variables. How can I execute smf service in user... (1 Reply)
Discussion started by: Sivaramakrishna
1 Replies

2. UNIX for Advanced & Expert Users

[BASH] Read value of variable, but not comment on the same line

Heyas So while i'm trying to increase security/usability of my TUI commands, i'm currently at tui-conf-get. There was also a bug, i wanted to fix, but sadly that bugfix is more insecure - but twice as fast as my current buggy method. I've added a getopts toggle, '-s' to toggle beSecure,... (8 Replies)
Discussion started by: sea
8 Replies

3. UNIX for Dummies Questions & Answers

How to prompt user to define a variable?

Hi everyone, Is it possible to define blank vaianbles and prompt user to fill them during the script execution? A very simple example: INPUT= OUTPUT= cut -f1-4 $INPUT | sed 's/hello/goodbye/g' | sort -uV > $OUTPUTThank you in advance! Best wishes (2 Replies)
Discussion started by: lsantome
2 Replies

4. UNIX for Dummies Questions & Answers

print user variable input

this may be basic thing for everyone here, but i cant push awk to print the variable user input which is INS, please help. code: INS=$1 printf '\n' symdg list | grep $INS-clone | awk -v i=$INS '{ID=substr($4,9,4)}{print "Device Group: "$1,"at Array "ID,i}' output: $ ./test.sh patty ... (5 Replies)
Discussion started by: prodigy06
5 Replies

5. Shell Programming and Scripting

User interaction that passes the answer to a variable

Please tell me how to write a bash script that asks the user to enter a word and that passes the entered word to a variable. echo "Type a word and press the Enter key:" myVar=`cat` echo "You entered $myVar" The above code is very awkward, because it requires the user to enter... (2 Replies)
Discussion started by: LessNux
2 Replies

6. Programming

how to user get unix variable USER in C

in a C program, how do you access the unix environment variable USER for example? (1 Reply)
Discussion started by: omega666
1 Replies

7. Shell Programming and Scripting

Unable to add user defined variable

Hi, I have a user defined variable _TIME1=xxx I am using awk command for pattern matching. cat $_LOCATION/catalina.txt | awk '/^`$_TIME1`:??:??/' It not taking the value of $_TIME! eg:I am using the command to get all the patter from 12:00:00 to 12:59:59 The user defined variable... (2 Replies)
Discussion started by: ahamed
2 Replies

8. Shell Programming and Scripting

use awk to search a file using variable given from user

Hi! I want to print selected lines from a file using awk.The file contains 6 columns(dates,time,title,description,location and attendees). So i ask the user to insert the date that he wants to display and then search the file for the matching dates so i can print the line. echo Give the date... (7 Replies)
Discussion started by: DDoS
7 Replies

9. Shell Programming and Scripting

How do you take what a user types in and convert it into a variable to be used

I am a newbie to programming on the unix Command Line*, and was wondering how you take what a user types in and convert it into a variable to be used in the script? *I always used it for file editing, but nothing more. Then I began to use BBedit. :confused: (1 Reply)
Discussion started by: signebedi
1 Replies

10. Shell Programming and Scripting

Replace variable with a user defined variable

I have a file that has a list of entries in a column x z z z x y z The column can have any length and any number of any strings. I need to replace each unique string with a user defined number. I can filter the unique entries out using awk '{if (NF==5) print $2}' file | uniq | nl >... (1 Reply)
Discussion started by: ce124
1 Replies
Login or Register to Ask a Question