944,074 Members | Top Members by Rank

Ad:
Jun 8th, 2007
0

shell script

Expand Post »
Hi, I need some guidelines to start coding a shell script that will provide the administrator with the shutdown options :
-shutdown -now shutdown -h ?
-shutdown [time] , which i have no clue how to use a variable so the user can manually select a time to shutdown.
-shutdown (in minutes) , i know shutdown -t is for secs but what about minutes?

also, do i need to use a loop for this options? for example the user accidentally press the option 2 which is the shutdown time and he wanted to use option 1 instead.

Thanks in advance

sam
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
peacesam is offline Offline
6 posts
since May 2007
Jun 9th, 2007
0

Re: shell script

though i cant solve all your question at once, but i can give you some guidelines untill a more experienced person comes through,
to assign variables in linux use the comand as follows
example
set variable="as"
then to call on it use $variable
variable being any name you want.
as for using mathemtical numbers it would be the same thing unless you need arithmetics for them you can use the "expr"
to read variables a user inputs , you would define a varialbe then use the read command
example:
#!/bin/bsh/
echo " please enter what time u would like shutdown"
read TIME
echo $TIME

this should cover the ruff idea ill try and get back to u if i go through more,

p.s. for date & time option the command is date , Try man date to see more options, i dont know much of the top of my head

Good Luck
Reputation Points: 10
Solved Threads: 0
Newbie Poster
slbit is offline Offline
7 posts
since Jun 2007
Jun 9th, 2007
0

Re: shell script

cool man! thanks alot, im gonna boot up my vmware to linux so i can try the codes now..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
peacesam is offline Offline
6 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Please need help with bash script
Next Thread in Shell Scripting Forum Timeline: Concat files with similar names in different directories





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC