Batch file or whatever you want to call it

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Txnca

Batch file or whatever you want to call it

Post by Txnca »

Does Linux have a easy scripting language like DOS/Windows Batch files? If so, where can I find information about the commands and syntax of it? Or maybe you can just help me make a script that will do what I need it to do.

What I am trying to do is when I download a specific type of file from the net with Firefox, that it will run this "file"(Which is really just command) which will send the information to another program. And before you say, 'Well Firefox does that already", yes it does, but not for what I need it to do. The exact ting I need it to do is when I download a torrent file, that it runs this command:

env WINEPREFIX="/home/dad/.wine" wine "I:\uTorrent\utorrent.exe"

Any help would be appreciated.

Steve
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
maguire.brendan

Re: Batch file or whatever you want to call it

Post by maguire.brendan »

There are a number of scripting languages you can use in Linux for this sort of task. The most appropriate here would be bash (just google it, loads of info out there).

So create your script. Make it executable:

Code: Select all

chmod +x your_script
Then tell firefox to open .torrent files with your script from now on.

Also, is there a particular reason you want to use uTorrent? There are loads of good alternatives out there. KTorrent and Transmission spring to mind.
vincent

Re: Batch file or whatever you want to call it

Post by vincent »

I believe that Linux shell scripts would probably be the equivalent of Windows batch files, and the GNU Bourne-Again Shell (commonly referred to as bash) is most often used to run those scripts (bash also interprets the commands you input to a Terminal).

For some basic bash commands: http://ss64.com/bash/
This might also prove helpful: http://www.linux.org/docs/ldp/howto/Bas ... HOWTO.html

Try this out first, to get a feel of bash and shell scripts. Create a file named "hello.sh" in your /home/<user> directory with the following contents:

Code: Select all

#!/bin/bash
echo "Hello, world."
Then, in a terminal, type:

Code: Select all

chmod +x hello.sh
./hello.sh
You should get "Hello, world." as an output in your terminal.

Of course, there's a lot more you can do...I'll leave it up to you to create your own shell script for Firefox and torrents. ;)

One small note: there is no native Linux version of uTorrent, so you'll have to run it in Wine, but I'm not sure if it works or not like that. Give Transmission a try...it's the default BitTorrent client installed in Linux Mint.
Txnca

Re: Batch file or whatever you want to call it

Post by Txnca »

maguire.brendan wrote:Also, is there a particular reason you want to use uTorrent? There are loads of good alternatives out there. KTorrent and Transmission spring to mind.
I haven't seen KTorrent, but I have seen Transmission, and frankly I wasn't impressed. It seems like it was out of the dark ages. i am sure that it is a good bit torrent client but I prefer uTorrent. I will take the time to look at a few others, since you mentioned KTorrent I will take a look at it. I used to use Azureus, but then it was taken over by Vuze and it is crap now. So I started looking around and found uTorrent and it is an excellent client and it is very small, something I really like about it.

Steve
BrianD

Re: Batch file or whatever you want to call it

Post by BrianD »

steve --

you might also check out Deluge, which is quite popular... and qBittorrent, which is quite capable.
maguire.brendan

Re: Batch file or whatever you want to call it

Post by maguire.brendan »

I've not used uTorrent but a lot of reviews consider KTorrent as the (better?) Linux alternative to uTorrent.

http://www.aeonity.com/frost/ktorrent-l ... lternative
http://digg.com/linux_unix/ktorrent_uto ... _for_linux

At the end of the day choice is key. Use whatever suits you best and if uTorrent over wine is the best solution then continue as is.

Good luck with the script.
mick55

Re: Batch file or whatever you want to call it

Post by mick55 »

BrianD wrote:you might also check out Deluge
+1
Txnca

Re: Batch file or whatever you want to call it

Post by Txnca »

Thanks guys! Appreciate the input. I see Deludge(x2, :wink: ), qBittorrent, and KTorrent. I'll give them all a look see. I don't have a problem with checking out new software. Never can tell when you will find that one piece of software that you can't live without!

Steve
Locked

Return to “Beginner Questions”