LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-30-2004, 02:19 PM   #1
Ace Rimmer
LQ Newbie
 
Registered: Mar 2004
Posts: 4

Rep: Reputation: 0
Writing Shell Scripts in Redhat 6.1 KDE


I'm looking to write some basic scripts in order to make Linux a bit easier to use.

As much as I <i>enjoy</i> going into the console to shutdown my computer at night, It'd be much easier to have an icon on my toolbar. Try as I might, I can't get this to work.

The exact command line I'm trying to use is "shutdown -h now"
Any help?
 
Old 03-30-2004, 02:21 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
You'd have to run that command as root (unless you can usually do it as a normal user?). Anyway:
Code:
#!/bin/bash
/sbin/shutdown -h now
should be all you need.
 
Old 03-30-2004, 02:29 PM   #3
Ace Rimmer
LQ Newbie
 
Registered: Mar 2004
Posts: 4

Original Poster
Rep: Reputation: 0
Err... Perhaps I didn't make it clear what I'm trying to do.
I want to create the equivalent of a Windows .bat file, i.e. one that will automatically execute console commands.
 
Old 03-30-2004, 02:31 PM   #4
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
Errrr, perhaps that's exactly what I've just given you!
Stick it in a file, change it to be executable by using:
Code:
chmod +x filename
then typing 'filename' will run the script. You should be able to stick an icon to it on Gnome/KDE/WindowMaker.

Sorry, my fault, forgot to mention making it executable.
 
  


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
Difficulties writing shell scripts lostinsyntax Programming 8 05-02-2005 07:42 AM
Difficulties writing shell scripts lostinsyntax Linux - Newbie 2 05-01-2005 03:48 PM
I'm terrible at writing shell scripts. A little help fetching files? ashibaka Linux - General 6 04-10-2004 12:41 AM
Writing C++ Shell Scripts MasterKin8T Programming 5 09-29-2003 10:43 AM
writing Linux shell scripts in Windows NightWolf_NZ Linux - Newbie 3 09-10-2003 09:28 PM


All times are GMT -5. The time now is 12:19 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration