LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-07-2003, 11:00 PM   #1
Micro
Member
 
Registered: Nov 2002
Location: New Jersey
Distribution: rh 8.0
Posts: 45

Rep: Reputation: 15
writing a batch file ????



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

micro
 
Old 01-07-2003, 11:48 PM   #2
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
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
 
Old 01-08-2003, 12:30 PM   #3
Micro
Member
 
Registered: Nov 2002
Location: New Jersey
Distribution: rh 8.0
Posts: 45

Original Poster
Rep: Reputation: 15
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
 
Old 01-09-2003, 11:04 AM   #4
rootboy
Member
 
Registered: Oct 2001
Distribution: Mint 15
Posts: 770

Rep: Reputation: 51
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
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sftp using a batch file JeRrYmAn Linux - Security 2 05-05-2006 10:15 AM
Need help writing a batch/script file cbjhawks Linux - General 1 01-28-2004 05:54 PM
"batch script": writing and running Jalalabee Linux - Newbie 5 09-09-2003 11:22 PM
Writing Scripts or Batch files? Nicksan Linux - Software 1 06-29-2003 11:49 PM
Bigslack Batch File Mal Slackware 1 07-03-2002 10:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:00 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration