LinuxQuestions.org
Visit Jeremy's Blog.
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 03-02-2015, 03:35 AM   #1
aaja
LQ Newbie
 
Registered: Mar 2015
Posts: 3

Rep: Reputation: Disabled
Linux from Windows- bash ,shell


Hello am a newbie to linux,
I tried to install cygwin for windows,all i need is i need to write a shell program for a batch file i already have, I am not able to do this.
My batch file content looks like

SET JAVA_HOME=..\jdk
SET CLASSPATH="%CLASSPATH%;../lib/A.jar;../lib/slf4j-api-1.6.1.jar;../lib/slf4j-simple-1.6.1.jar"

%JAVA_HOME%\bin\java.exe com.A ../conf/C.properties

PAUSE

this works perfectly, I try to write a shell program which is failing when i check it through cygwin. i am not able to set the export to java_home.
The pblm i face is say my current directory where my shell program is 'Z'
then i want to get back to 'y' where X has two sub folders y and z

X
-Y (is jdk )
-Z (where shell pgm resides)

cd ../ or any combination of cd doesnot work in my shell script.

Please help me. Any help is greatly appreciated
 
Old 03-02-2015, 03:38 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,172

Rep: Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672
in cygwin (or linux) do not use \ but /, so JAVA_HOME=../jdk.
also do not use %JAVA_HOME% but $JAVA_HOME
\ and % works only in windows' cmd shell.
 
Old 03-02-2015, 03:43 AM   #3
aaja
LQ Newbie
 
Registered: Mar 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
no i have tried it , it did not work
 
Old 03-02-2015, 03:44 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,172

Rep: Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672
what did you try exactly?
 
Old 03-02-2015, 03:50 AM   #5
aaja
LQ Newbie
 
Registered: Mar 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
export JAVA_HOME=../jdk
echo $JAVA_HOME

this one does not work it says

../jdk

this is wrong, it should display the structure as X/jdk
 
Old 03-02-2015, 04:10 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,172

Rep: Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672Reputation: 2672
JAVA_HOME is a variable, you set its value to ../jdk, and that's all. If you need another value, try to set that.
You can use set -vx at the beginning of your script to see what's happening (that will not solve any issue just show you how the program works)
 
Old 03-02-2015, 04:34 AM   #7
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,539

Rep: Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419
From the File Access section of the Cygwin Users Guide
Quote:
A special case is the so-called cygdrive prefix. It's the path under which every available drive in the system is mounted under its drive letter. The default value is /cygdrive, so you can access the drives as /cygdrive/c, /cygdrive/d, etc...
As near as I can understand from your post you want:
Code:
TOP_DIRECTORY="<full path to directory X>"
SHELL_PROGRAM_PATH=$TOP_DIRECTORY"/Z"
JAVA_HOME=$TOP_DIRECTORY"/Y"
 
  


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
ssh from solaris 9 with a bash shell of 2.0 to suse 3.2 bash shell slufoot80 Solaris / OpenSolaris 3 09-19-2012 03:06 PM
ssh from solaris 9 with a bash shell of 2.0 to suse 3.2 bash shell slufoot80 Solaris / OpenSolaris 1 09-19-2012 01:19 PM
Hello, I am new to Linux and need some help with bash shell. Steph90231 Linux - Newbie 6 09-17-2008 10:37 PM
Print directly to Windows network printer within a bash shell script jwillyuaz Linux - Newbie 1 02-12-2008 02:15 AM


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