LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 09-26-2005, 10:39 AM   #1
yekrahs
Member
 
Registered: Aug 2005
Location: England
Distribution: SUSE 10.0, LiMP (Linux Multimedia Player)
Posts: 86

Rep: Reputation: 15
Problems compiling a simple shell program


I'm not into heavy programming or anything, but I'd just like to know how to create and compile just a simple program of a few shell commands to make things easier, save having to type in a list of commands manually in shell each time I want them performed.

Just something along the lines of: (simple shell commands)

cp /*/file /*/directory
cp /*/file2 /*/directory2
rm /*/file /*/directory
mount -t .... [etc.]


I tried using Kdevelop: scripting , but the help files were poor and contained no information on how to compile into a proper program. (That section in the help file had the words "yet to be written" or something).

*So what program would I use?*
*And what buttons would I have to click on to compile in this program?*(simple language would help! i.e. point here and click there)


Also, would anyone know how I would get this program file (once it has been compiled) to autostart with KDE?



Thanks a lot

Last edited by yekrahs; 09-26-2005 at 10:40 AM.
 
Old 09-26-2005, 10:52 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Shell scripts are interpreted, not compiled. Open a text editor of your choice and create a file like:
Code:
#!/bin/bash

echo hello world
Save it, and add the executable bit (chmod +x), and then run it: ./scriptname
 
Old 09-26-2005, 10:54 AM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

You just write the commands in a text file. No compilation required.

The file should start with
Code:
#!/bin/bash
then just have each command on its own line. To make the script executable, do 'chmod +x /path/to/script'.

To have the script run automatically, have a look in ~/.kde . There should be a directory called 'Autostart'. Just stick the script in there.

Dave

Last edited by ilikejam; 09-26-2005 at 10:55 AM.
 
Old 09-26-2005, 12:07 PM   #4
yekrahs
Member
 
Registered: Aug 2005
Location: England
Distribution: SUSE 10.0, LiMP (Linux Multimedia Player)
Posts: 86

Original Poster
Rep: Reputation: 15
Hey! You guys sound pretty knowledgeable.

Could you help me with another easy problem? (about setting flags in sudo)
Despite the simplicity of the question, I'm beginning to think I should have put it in the programming forum!



http://www.linuxquestions.org/questi...hlight=insults


P.S. Does anyone know how to bump a post back up to the top? (My q is on about page 3 by know and it hasn't been resolved yet).
 
  


Reply



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
Compiling a simple C++ program for Windows Baix Programming 2 03-05-2005 07:17 PM
compiling simple c/c++ program but no good freeindy Programming 3 02-12-2005 11:38 AM
simple Shell program for pro's ..but need some help Software Linux - Software 21 02-11-2004 01:28 AM
Compiling a simple C++ program kbeaver Programming 27 02-06-2004 08:02 PM
Simple Bash Shell Program frankblack Programming 2 02-14-2003 11:59 PM

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

All times are GMT -5. The time now is 01:49 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