LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Bodhi
User Name
Password
Bodhi This forum is for the discussion of Bodhi Linux.

Notices


Reply
  Search this Thread
Old 06-28-2020, 07:18 PM   #1
questionsBot
Member
 
Registered: Jun 2020
Posts: 68

Rep: Reputation: Disabled
How can I make a "bat" file? (or w/e the BodHi version of that is?


What do you call it when you make a bat file in linux.. as in make a simple command that runs a series of commands.

Basically I would like to make a file that simply runs a series of commands one after the other and takes a variable.

Code:
mycommand thisisatest
for example that runs from the terminal, and can run from anywhere like the other terminal commands,
 
Old 06-28-2020, 07:35 PM   #2
cordx
Member
 
Registered: Oct 2018
Location: texas
Distribution: bodhi 5.1.0
Posts: 598

Rep: Reputation: 148Reputation: 148
this is not an area that i have much experience in, but hopefully having some terminology will help you run some searches. i have heard them called either just scripts or shell scripts. i wrote this very rudimentary one to run an rsync command:
Quote:
#!/bin/bash
rsync -rahP --delete /home/user/source /media/user/destination
from my admittedly limited understanding the first part (#!/bin/bash) is called a shebang and is necessary to tell your system what shell will be used to run the script (i have also seen python used). bodhi (as with many linux systems) uses bash by default. the rest is just a regular command that i could have run in a terminal.

you can write that in just a regular text file and save it with whatever you want to name your script/command. i have seen some people name theirs with a .sh extension, but i don't know if that is mandatory or just suggested or even necessary.

once it is created, you need to make it executable with chmod. after that you can click it's icon in the gui to run it. getting it to run
Quote:
from anywhere like the other terminal commands
may be a bit more tricky depending on what you mean by anywhere, but those are pretty much the basics that i know.
 
Old 06-28-2020, 07:48 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 16,310
Blog Entries: 27

Rep: Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876
In Linux lingo, what you want to do is write a "script."

A web search for "linux scripting howto" will turn up many links and tutorials.

My personal favorite, though, is Machtelt Garrels's BASH Guide for Beginnners. It hasn't been updated since 2008, but BASH hasn't changed much since then, and it's very well written.
 
2 members found this post helpful.
Old 06-28-2020, 08:19 PM   #4
questionsBot
Member
 
Registered: Jun 2020
Posts: 68

Original Poster
Rep: Reputation: Disabled
Great, thanks guys.
 
Old 06-28-2020, 10:03 PM   #5
cordx
Member
 
Registered: Oct 2018
Location: texas
Distribution: bodhi 5.1.0
Posts: 598

Rep: Reputation: 148Reputation: 148
this was just posted as well.
 
  


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
[SOLVED] BAT script to copy files and run anther bat script? nibraz Programming 17 11-22-2016 03:56 AM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM
How to create a ".bat" equivalent file Micro420 Linux - Software 4 11-11-2004 03:41 PM
Linux version of a .bat file? bigbear_2345 Mandriva 2 12-04-2003 05:46 PM
The Linux version of autoexec.bat ??? Canaris Linux - Newbie 9 05-27-2003 07:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Bodhi

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