The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling a shell script from php eltinator Shell Programming and Scripting 1 04-22-2008 01:16 AM
Calling shell functions from another shell script jisha Shell Programming and Scripting 6 04-05-2008 04:29 PM
Calling Shell Script onlyroshni Shell Programming and Scripting 1 10-22-2007 07:29 PM
calling sqlplus from shell suds19 Shell Programming and Scripting 2 10-24-2002 04:01 PM
Calling shell script ? Ravi_Kandula Shell Programming and Scripting 1 10-07-2002 09:30 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-30-2007
andy2000 andy2000 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 36
calling a prg from the shell!!!

Hi,

can somebody please answer my questions:

1) is the "sh" available on all unix systems at /bin/sh ???

2) how to make the following call working:

`which java` -cp $JAVA_HOME MyClass

since I do not know the location of java :-((

Last edited by andy2000; 03-30-2007 at 08:33 AM..
  #2 (permalink)  
Old 03-30-2007
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
1) Do ls -1 /bin/*sh
- This would probably list of shells available of your machine.

/bin/bash*
/bin/csh*
/bin/jsh*
/bin/ksh*
/bin/pfcsh*
/bin/pfksh*
/bin/pfsh*
/bin/remsh@
/bin/rksh*
/bin/rsh*
/bin/sh*
/bin/ssh*
/bin/tcsh*
/bin/zsh*


2)Find out the java path on you machine,most of the times its under /usr/bin/java,else do a find for java

Add that path (/usr/bin/java) to your PATH variable
Once the PATH is set ,you dont have to say which java.

Please search the forum of adding PATH to your shell .profile file


Thanks
Nagarajan Ganesan
  #3 (permalink)  
Old 03-30-2007
andy2000 andy2000 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 36
I think u did not understand my questions:

1) is the location /bin/sh a standard on all Unix systems (aix, hp-ux, linux, sun ...)???



2) since I do not want to care where java located:
`which java` -cp $JAVA_HOME MyClass

:-(
  #4 (permalink)  
Old 03-30-2007
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,209
from the Unix specification:

Quote:
Applications should note that the standard PATH to the shell cannot be assumed to be either /bin/sh or /usr/bin/sh, and should be determined by interrogation of the PATH returned by getconf PATH , ensuring that the returned pathname is an absolute pathname and not a shell built-in.

For example, to determine the location of the standard sh utility:

command -v sh
  #5 (permalink)  
Old 03-31-2007
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by andy2000
I think u did not understand my questions:

1) is the location /bin/sh a standard on all Unix systems (aix, hp-ux, linux, sun ...)???

It is the standard location for a Bourne-type shell; it may or may not be a POSIX shell

Quote:
2) since I do not want to care where java located:
`which java` -cp $JAVA_HOME MyClass

If java is not in your PATH, then which (which is an unreliable command; there are at least two versions of it, one of which will not work in a Bourne-type shell) will probably not find it.

If java is in your PATH, you don't need which, just use the command name.

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:06 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0