calling a prg from the shell!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calling a prg from the shell!!!
# 1  
Old 03-30-2007
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 09:33 AM..
# 2  
Old 03-30-2007
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  
Old 03-30-2007
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  
Old 03-30-2007
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  
Old 03-31-2007
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.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

calling syncsort in shell script

Hi, pls, tell me how to use syncsort in shell script? if i have to sort a file, what are the syncsort commands i hav to use ? say abc.dat is my file and dt, Id are my key columns. (0 Replies)
Discussion started by: captain haddock
0 Replies

2. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

3. Shell Programming and Scripting

Calling another shell script

Hi there, I have an script reading content of a file and runs whatever command is specified there, as follows #!/bin/bash # Supposed to read from a file that commands are listed to be run # when the server starts for initialization CMD_FILE=/myScripts/startup/task2do.txt if ; then ... (2 Replies)
Discussion started by: james gordon
2 Replies

4. Shell Programming and Scripting

Calling shell functions from another shell script

Hi, I have a query .. i have 2 scripts say 1.sh and 2.sh 1.sh contains many functions written using shell scripts. 2.sh is a script which needs to call the functions definded in 1.sh function calls are with arguments. Can some one tell me how to call the functions from 2.sh? Thanks in... (6 Replies)
Discussion started by: jisha
6 Replies

5. Shell Programming and Scripting

Calling Shell Script

Hello Friends, I have bash script on unix server which i want to call from windows server. Basically i want a command line which will call this script on unix server. Any one has any idea regarding this? Help really appreciated!! Thanks, Roshni. (1 Reply)
Discussion started by: onlyroshni
1 Replies

6. Shell Programming and Scripting

Is there a diff way to exec this shell prg??

Hi, I want to know whether it is possible to to execute the below script like ksh ds.ksh <input file> > <output file> or any other simple way other then ./ The way i'm executing it right now is nawk -f ds.ksh <input file> > <output file>. I need the first format as my ETL tools is... (3 Replies)
Discussion started by: kumarsaravana_s
3 Replies

7. Shell Programming and Scripting

calling sqlplus from shell

Hi All, I am executing the following code :- sqlplus -s ${DATABASE_USER} |& print -p -- 'set feed off pause off pages 0 head off veri off line 500' print -p -- 'set term off time off serveroutput on size 1000000' print -p -- "set sqlprompt ''" print -p -- "SELECT run_command from... (2 Replies)
Discussion started by: suds19
2 Replies

8. Shell Programming and Scripting

Calling shell script ?

hi friends, i'm new to unix and straight away i had to start with the script files. I've a script file which gets called from a menu item on a GUI. This script file again calls .awk file, in performing some tasks , which also generates certain files. I modified the files to generate some... (1 Reply)
Discussion started by: Ravi_Kandula
1 Replies

9. Cybersecurity

Calling nessus from shell..

I am trying to code a php script that calls upon the "nessus" client; and formats the output into a HTML table. Somehow, my shell scripts don't seen to be working correctly...is my syntax messed up? Here's what i got: <CENTER><BR><BR><BR><BR> <table width="" border="0" cellspacing="1"... (0 Replies)
Discussion started by: thomas.jones
0 Replies

10. UNIX for Dummies Questions & Answers

calling a c function from shell

Is it possible to call a C function from within a shell script. This C function is part of an API. What do I need to make it work from my shell script. Anybody please help. (4 Replies)
Discussion started by: seshagiri
4 Replies
Login or Register to Ask a Question