LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   writing a batch file ???? (https://www.linuxquestions.org/questions/linux-general-1/writing-a-batch-file-40673/)

Micro 01-07-2003 11:00 PM

writing a batch file ????
 
:Pengy:
Coming from the DOS world we used batch file or macros to automate long command line functions. I have a list of commands I would like to execute like a batch file and I was wondering if somone could give me a clue.

The command are mounts for setting up network shares with my windows machines using smbfs. I know I could automount them on boot but I would rather have the control to mount them and then unmount them using a batch file type macro file. Would it be a script in the linux world if so how do i create it and then run it. any help would be great thx

"helping the free world get a little free'er" LINUX RULES

:D :) :) :) micro

rootboy 01-07-2003 11:48 PM

It's (can be) really simple, start with:

#!/bin/bash

To tell linux which shell to use, then just add your commands. e.g.:

mount /share1
mount /share2

Save the file as whatever, then do a "chmod 755 whatever" to make it executable (assuming that these are the permissions that you want the file to have).

Here's some links to some light reading :)

http://www.linuxfocus.org/English/Se...ticle216.shtml
http://www.google.com/linux?hl=en&lr...ll+programming


John

Micro 01-08-2003 12:30 PM

I figured it out and it worked great I used pico to create a new file put the (#!/bin/bash/) in there and went to town with my commands. Then did the chmod 755 filename and ran it execpt for a few typos it worked fine. I am going to be a shell scripting madman watch out world.

Thank man you put me on the right track anbd thats what I needed

micro out

rootboy 01-09-2003 11:04 AM

Quote:

Originally posted by Micro
I figured it out and it worked great I used pico to create a new file put the (#!/bin/bash/) in there and went to town with my commands. Then did the chmod 755 filename and ran it execpt for a few typos it worked fine. I am going to be a shell scripting madman watch out world.
Uh oh! :)

Next time try "mc". It is a Norton Commander clone and has its own editor. Very nice.


Quote:

Thank man you put me on the right track anbd thats what I needed

micro out

Anytime. Enjoy :)


John


All times are GMT -5. The time now is 11:00 PM.