LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-28-2004, 03:28 PM   #1
Soulful93
Member
 
Registered: Dec 2003
Location: Denver, CO
Distribution: SuSE 9.2 Slackware 10.1
Posts: 137

Rep: Reputation: 15
Bash Shell Scripting *Integrate two scripts*


I'm working on an assignment for my UNIX administration class and the teacher is making us make an add, remove, and modify (groups ect..) users script. I have a couple of admin scripts that I use on my system at home that I'd like to incorparate into one "general task" admin script.

I'm still learning but I'm stumpt on how to tie two of my scripts together, I'm also having trouble with two parts of my add rm & modify user script ie.. listing groups, adding a new user to a specific group, and changing a users group once it has already been created.

Can someone assist me on something, I'm really stuck.

Here they are, your also welcome to take these and use them if you wish =) Anyhow,

Add Remove Modify Script:

||CODE||# Admin - lets users add and modify users

clear
# show the menu
clear

tput cup 10 20
tput smso
echo "Please choose from the following options:"
tput rmso
tput cup 12 25
echo " A)dd user"
tput cup 13 25
echo " M)odify user"
tput cup 15 20
echo -n "Selection:"
read choice

# detemine which choice was selected
case= $choice in
# add a user
[aA]) echo "Add a user!"
echo "What is the user name of the new user that you wish to add?"
read username
echo "What is the full name of the new user?"
read fullname

useradd -c"$fullname" $username

;;
# modify a user
[mM]) clear

echo "Modify a user!"
*) echo invalid input;;
esac||CODE||

Removing Temp Build-up Script (This is the one that I'd like to intergrate into the Add rm script, I plan on adding it to the AR menu I just can't figure out how to call it. Also, I need to figure out how to actually delay some of the script from running; I'd like to put a 5 sec interval at every pwd so the user can actually see what directory their deleting files from. Also if you know of anymore temp directorys (mozilla, konqueror cache whatever) let me know so I can add it. Oh I'm also going to list required configuration and system files for each directory before the rm -i is run in the peticular directory.

cd
cd Incomplete
pwd
rm -i *
clear
cd
cd .thumbnails
cd large
pwd
rm -i *
clear
cd
cd .thumbnails
cd normal
pwd
rm -i *
clear
cd
pwd
echo Temp Cleaning is Complete

Sorry this was so long...
Thanks in advance.
 
Old 04-29-2004, 05:07 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
To call a script you can just use name of it.
eg.
If you have scripts foo and bar
Writing '/path/to/foo' in bar causes for to be executed.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash shell scripting Sco Linux - Newbie 1 11-09-2004 11:58 AM
Help with I/O on bash shell scripting Dave6383 Programming 1 06-03-2004 05:24 PM
some bash shell scripting eltongeoff Linux - Newbie 2 10-22-2003 01:10 PM
Bash Shell Scripting Help Tangerine Programming 6 05-06-2003 02:10 PM
BASH Shell scripting help ewarmour Linux - General 8 05-25-2002 07:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:24 PM.

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