LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Problems compiling a simple shell program (https://www.linuxquestions.org/questions/programming-9/problems-compiling-a-simple-shell-program-367178/)

yekrahs 09-26-2005 10:39 AM

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

Matir 09-26-2005 10:52 AM

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

ilikejam 09-26-2005 10:54 AM

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

yekrahs 09-26-2005 12:07 PM

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).


All times are GMT -5. The time now is 04:55 AM.