•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,428 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,595 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 829 | Replies: 2
![]() |
•
•
Join Date: May 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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
-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
•
•
Join Date: Jun 2007
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Sending email from a shell script (Shell Scripting)
- Problem with variables in Windows shell script (Windows NT / 2000 / XP / 2003)
- Using find in a bash shell script (Shell Scripting)
- Shell Script for Gnome 2.6 Print Manager. (Shell Scripting)
- How to su properly in a shell script (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: Please need help with bash script
- Next Thread: Concat files with similar names in different directories


Linear Mode