LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 08-23-2013, 12:32 PM   #1
tukk
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Rep: Reputation: Disabled
Cant run .bat files


Hey,

Im new to linux and I was wondering if there was a easy way to convert/re-write a .bat files to .sh

I have 3 .bat files ( they are small, like 20 words)
 
Old 08-23-2013, 12:38 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

if I remember correctly a .bat file is some sort of MS windows script. So, the general approach would be to learn some basic bourne shell scripting. See for example http://rute.2038bug.com/node10.html.gz

If you have trouble post back explaining what you have tried and what specific problem(s) you are having and I'm sure we can help.

Evo2.
 
Old 08-23-2013, 12:41 PM   #3
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
You have to work out what the Linux equivalent commands are,


something to get you started
http://tldp.org/LDP/Bash-Beginners-Guide/html/

if you are stuck, post one of your .bat scripts
please use
[code]
Your code
here
[/code]

edit:
missed
http://www.tldp.org/LDP/abs/html/

actually,. Evo2's is better

Last edited by Firerat; 08-23-2013 at 12:46 PM.
 
Old 08-23-2013, 12:46 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,813

Rep: Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958Reputation: 5958
Including...
http://tldp.org/LDP/abs/html/dosbatch.html
 
Old 08-23-2013, 12:46 PM   #5
tukk
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
I am a noob , i have no idea what to do

Here is one of my Batch file.
Code:
@echo off
title Running
"C:\Program Files\Java\jre7\bin\java.exe" -Xmx512m -cp bin;lib/* dragonkk.rs2rsps.Server
pause
 
Old 08-23-2013, 12:51 PM   #6
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
that's actually really easy

fist figure out if you have java
Code:
java -version
then read its man(ual)
Code:
man java
 
1 members found this post helpful.
Old 08-23-2013, 01:32 PM   #7
tukk
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Could someone convert this to linux for me :\

Code:
@echo off
title Running
"C:\Program Files\Java\jre7\bin\java.exe" -Xmx512m -cp bin;lib/* dragonkk.rs2rsps.Server
pause
 
Old 08-23-2013, 01:58 PM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

that is really just a single command: running java with some arguments. Read the java man page (see Firerat's post) to understand the options that are big used.

Evo2.
 
Old 08-23-2013, 03:15 PM   #9
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
@tukk

have a go..
if you are still stuck show us what you tried and we will steer you

can of worms..
but do you have java installed?

Last edited by Firerat; 08-23-2013 at 03:17 PM.
 
Old 08-24-2013, 03:54 AM   #10
tukk
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
I tried this

Code:
Java -classpath bin;lib/* dragonkk.rs2rsps.Server
But that didnt work, can someome help me out please
 
Old 08-24-2013, 04:10 AM   #11
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 648

Rep: Reputation: 189Reputation: 189
Try with a lowercase java
 
Old 08-24-2013, 04:29 AM   #12
tukk
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
It already was with a lower case (I didnt copy the 'java' part)
 
Old 08-24-2013, 04:32 AM   #13
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,276
Blog Entries: 24

Rep: Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224
Quote:
Originally Posted by tukk View Post
I tried this

Code:
Java -classpath bin;lib/* dragonkk.rs2rsps.Server
But that didnt work, can someome help me out please
man java
Quote:
-classpath classpath

-cp classpath
Specify a list of directories, JAR archives, and ZIP archives to search for class files. Class
path entries are separated by colons (: )
. Specifying -classpath or -cp overrides any setting of
the CLASSPATH environment variable.
Plus, that does not look like a good path, check your java environment.

What does this say?

Code:
echo $CLASSPATH

Last edited by astrogeek; 08-24-2013 at 04:40 AM.
 
Old 08-24-2013, 04:32 AM   #14
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 648

Rep: Reputation: 189Reputation: 189
Please post the errors that you get, as we can't give any good, targeted advice without them.
 
Old 08-24-2013, 01:59 PM   #15
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Also, the semicolon is a delimiter in bash scripts, so, instead of java -classpath bin;lib/* dragonkk.rs2rsps.Server try java -classpath 'bin;./lib/*' ./dragonkk.rs2rsps.Server
where I've indicated the changes I'd suggest in red. (The single-quote (') tells bash to pass everything between then on to the command without trying to interpret the text. The dot-slash (./) is a bash idiom that means "the current working directory." (Your command should work fine without it; I just put it in so you could see where to insert an actual folder name when you want to run the command from some directory other than the one containing the bin and lib directories, and the server code.
 
  


Reply



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
Delete all .log files and .bat files except the most recent? alancampbell6 Linux - Newbie 3 12-15-2011 09:17 AM
[SOLVED] How best to run Bacula's bat? catkin Linux - Software 6 03-02-2010 10:41 PM
Run BAT or EXE from WINDOWS on UNIX npati General 5 02-13-2008 04:00 PM
Does linux run bat files like DOS oldgi Linux - Software 6 07-05-2007 11:47 AM
how to run the *.bat file ztdep Linux - Software 8 07-19-2005 04:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:53 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
Open Source Consulting | Domain Registration