LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-07-2010, 04:09 PM   #1
Solouko
LQ Newbie
 
Registered: Apr 2007
Location: North Wales, UK
Distribution: Ubuntu 10.4ish
Posts: 20

Rep: Reputation: 0
err... What's the Linux equivalent of a windows batch file?


Hi, I'm trying to install a shedload of .deb files that I'm downloading, is there a way of typing out a batch file type thing which can install all of them without me having to type dpkg -i package_name.deb a squillion times?

Also, I'm having to download the deb files on my windows PC then transfer them by disk so... um... is there any way I could write out this batch file in a windows environment? or would I have to use a program inside my Linux install?

Easiest option please, I'm tired, drunk and naturally lazy.
Thank you.
 
Old 06-07-2010, 04:11 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
you can use
Code:
dpkg -i *.deb
For bash scripting take a look at
http://tldp.org/LDP/Bash-Beginners-G...ers-Guide.html

Last edited by repo; 06-07-2010 at 04:12 PM.
 
Old 06-07-2010, 04:22 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Quote:
is there a way of typing out a batch file type thing
We call that a script....

When Bill was in diapers and there was no DOS or Windows, the Unix elders also called it a script. So clearly, it is the MS world that is the abberation....
 
Old 06-07-2010, 04:30 PM   #4
Solouko
LQ Newbie
 
Registered: Apr 2007
Location: North Wales, UK
Distribution: Ubuntu 10.4ish
Posts: 20

Original Poster
Rep: Reputation: 0
aaah, a script, yes, I've heard that used before, now, although I don't know how to write one, at least I know what to call one!
 
Old 06-07-2010, 05:18 PM   #5
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,143

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by Solouko View Post
What's the Linux equivalent of a windows batch file?
I would paraphrase that question as

What is a Linux scripting language that is badly documented, internally inconsistent and not very powerful?

Sorry, you can find plenty of Linux scripting languages that are as badly documented as the Windows batch file language, but I don't think you can find one as internally inconsistent and lacking in power.

Seriously, bash scripting seems to be the most popular Linux tool filling the role of advanced .bat files in Windows.

But bash scripting is lot more powerful and complex than .bat files, so there is far more to learn. Hopefully you can find a simple subset of bash scripting that is easy to learn while already being more powerful than .bat files.

Anyway, there are several choices of "shell scripting" languages (such as bash) as well as other scripting languages. It sounds like your current task barely (if at all) needs scripting. Learning a little bash scripting is a good idea even if your current task doesn't require it.
 
0 members found this post helpful.
Old 06-07-2010, 05:25 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
Note that at the basic level a script is really just a file holding a series of shell commands to be executed, so most everything you can do in the shell can also be done in a script, and vice-versa.

I highly recommend linuxcommand.org as a good introduction to the bash shell and scripting. It will give you everything you need to know to get started.
 
Old 06-07-2010, 07:01 PM   #7
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 1,808

Rep: Reputation: 234Reputation: 234Reputation: 234
this command will do what you want:

for i in `ls *.deb`; do dpkg -i $i; done

note the use of `backticks` and not 'apostrophes'
 
Old 06-07-2010, 07:19 PM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,244

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Link in my signature.

jlinkels
 
Old 06-07-2010, 11:03 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Quote:
Easiest option please, I'm tired, drunk and naturally lazy.
I missed this previously---if those are the constraints, then I recommend staying with Windows.....
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allowing Windows batch file on Linux fedora 10 question lacko Linux - Server 3 11-11-2009 09:57 PM
Executing a batch file on Windows from Linux using a Shell-Script paragkalra Linux - Networking 3 08-13-2008 01:45 PM
Trigger linux command by windows batch file? mariusak Linux - Networking 6 06-03-2005 06:15 AM
call program on linux box from windows batch file naijaguy Programming 5 08-14-2004 12:12 PM
Batch File Equivalent johnsmith1169 Programming 4 05-16-2004 08:10 PM


All times are GMT -5. The time now is 02:04 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration