Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-25-2003, 07:28 PM   #1
Registered: Feb 2003
Posts: 159

Rep: Reputation: 30
HELP!! with scripting

I thought I had this down, but I can not figure out how to do this... I am writing some shell scripts for a class and I am stuck, and its due tomarrow. I have a variable called $user_add. I am trying to output $user_add to /tmp/addusertemp. Then, I need to join the file addusertemp with /etc/passwd.

I idea is I created a line with everything that it needs to add a user. Then I save it in a file called /tmp/addusertemp and finally it adds it to the end of the passwd file.

I know its last minute, but its all I have left. Help Me Please. Thanks.
Old 04-25-2003, 07:52 PM   #2
Registered: Dec 2002
Location: Virginia, USA
Posts: 131

Rep: Reputation: 15
Wouldn't it be something like:

echo $user_add > /tmp/addusertemp
cat /tmp/addusertemp >> /etc/passwd

The ">" overwrites everything in the file or creates it if it doesn't exist. You wouldn't want to have more than the current user info in that file.

The ">>" appends to the end of the file specified to the right.

Is this what you're looking for?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
new to scripting mifan Linux - Newbie 2 08-17-2005 12:10 PM
another help with scripting?! ice99 Programming 2 08-09-2005 08:56 AM
Need help scripting Tamara Programming 7 06-06-2005 02:06 AM
Scripting Help Please Jazinator Linux - Newbie 7 10-17-2004 06:35 PM
scripting bforest Linux - Newbie 4 05-11-2004 02:45 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration