LinuxQuestions.org
Visit Jeremy's Blog.
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 08-17-2003, 08:16 AM   #1
Gnute
Member
 
Registered: Apr 2003
Location: Kuwait
Distribution: NetBSD x86; Slackware Linsux i686 (A billion kilometers away)
Posts: 101

Rep: Reputation: 15
.bat file equivalent in linux?


i don't mean to sound "Microsofty" but how do i make something like a command executer file which will run a series of written commands like the dos .bat files? and what kind of file is it? .xxx?
and how is it executed?
thanks
 
Old 08-17-2003, 08:43 AM   #2
raylpc
Member
 
Registered: Jun 2003
Location: Canada
Distribution: Red Hat 9
Posts: 94

Rep: Reputation: 15
creat a textfile with the commands line by line. then
chmod +x filename
now run "./filename"
 
Old 08-17-2003, 08:44 AM   #3
Gnute
Member
 
Registered: Apr 2003
Location: Kuwait
Distribution: NetBSD x86; Slackware Linsux i686 (A billion kilometers away)
Posts: 101

Original Poster
Rep: Reputation: 15
so will 666 be ok for the chmod'ing?
 
Old 08-17-2003, 08:58 AM   #4
BongFish
Member
 
Registered: Jun 2003
Location: England
Distribution: Slack 9
Posts: 141

Rep: Reputation: 15
As long as the user you want to execute the file has execute permisions then it's fine.


A much better alternative to .bat files in linux are shell scripts.
They end in .sh and need # /usr/bin at the start. Well I think it's # /usr/bin, I can't remember, google it for shell scripts.

Shell scripts allow for 'if' startements and stuff like that.
 
Old 08-17-2003, 09:11 AM   #5
terrapin54
LQ Newbie
 
Registered: Aug 2003
Distribution: arch
Posts: 12

Rep: Reputation: 0
Here's a link to a guide that gives the shell script equivilent to a dos command. It's apart of the larger Advanced Bash-Scripting guide. This should give you a pretty good head start since your familiar with batch files.

Converting Dos to shell scripts

Last edited by terrapin54; 08-17-2003 at 09:23 AM.
 
Old 08-17-2003, 09:21 AM   #6
raylpc
Member
 
Registered: Jun 2003
Location: Canada
Distribution: Red Hat 9
Posts: 94

Rep: Reputation: 15
4= read, 2= write, 1 = execute.
so 666 is readable and writable for all users, but not executable.
first digit for owner, second for groupmates, third for others.

Shell script is indeed a better alternative, it starts with #!/bin/bash
 
  


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
Is there an equivalent of autoexec.bat in debian? Akhran Debian 5 09-13-2005 05:58 PM
What is the autoexec.bat and config.sys equivalent of linux lemuel Linux - Newbie 4 12-07-2004 09:34 PM
How to create a ".bat" equivalent file Micro420 Linux - Software 4 11-11-2004 03:41 PM
Linux Startup - AutoExec.bat equivalent? perry Linux - Software 6 05-03-2004 11:13 PM
Autoexec.bat Equivalent dwpondscum Linux - Distributions 5 06-16-2003 09:51 AM


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

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