Assigning output of command to a variable in shell

hi,
I want to assign find command result into some temporary variable:

jarPath= find /opt/lotus/notes/ -name $jarFile
cho "the jar path $jarPath"

where jarPath is temporary variable.

Can anybody help on this.

Thanks in advance
----Sankar

jarPath=`find /opt/lotus/notes/ -name $jarFile`
echo "the jar path $jarPath"

Hi,
Its not working...See i have written this code in some file called Notes.start

from bash i run like that ./Notes.start

its not giving any output....

Is there any constraints on different shell.I want to run the same file in AIX/Solaris/unix/linux.

and i am new this unix..

-sankar

this should work provided following are correct

Under /opt/lotus/notes/, there should be a file or directory with name in variable '$jarFile'.

Can you run the script in debug mode ? (give 'set -x' in the begining of the script) and paste the result here ?

file Name :::Notes_debug.start

set -x
jarFile=Notes.jar
if [ -f "$jarFile" ]; then
jarPath=`pwd`
fi
if [ $jarPath="" ]; then
jarPath= find /opt/lotus/notes/ -name $jarFile
echo "the jar path $jarPath"
fi

Output

+ jarFile=Notes.jar
+ [ -f Notes.jar ]
+ [ = ]
+ find /opt/lotus/notes/ -name Notes.jar
+ jarPath=
/opt/lotus/notes/65040/ibmpow/Notes.jar
+ echo the jar path
the jar path

In your script, i can see jarPath= find /opt/lotus/notes/ -name $jarFile
As I told you before please change this line to jarPath=`find /opt/lotus/notes/ -name $jarFile`

notice the backtick (backtick is with the tild key)

set -x

jarFile=Notes.jar

if [ -f "$jarFile" ]; then
jarPath=`pwd`
fi

if [ $jarPath="" ]; then
jarPath= `find /opt/lotus/notes/ -name $jarFile`
echo "the jar path $jarPath"
fi

+ jarFile=Notes.jar
+ [ -f Notes.jar ]
+ [ = ]
+ find /opt/lotus/notes/ -name Notes.jar
+ /opt/lotus/notes/65040/ibmpow/Notes.jar
+ jarPath=
/opt/lotus/notes/65040/ibmpow/Notes.jar: PK^C^D: not found.
/opt/lotus/notes/65040/ibmpow/Notes.jar[2]: ^X^U: not found.
/opt/lotus/notes/65040/ibmpow/Notes.jar[2]: 2: not found.
A file or directory in the path name does not exist.
/opt/lotus/notes/65040/ibmpow/Notes.jar[3]: ^Y^U: not found.
/opt/lotus/notes/65040/ibmpow/Notes.jar[3]: ^TMETA-INF/MANIFEST.MFManifest-Version:: 0403-005 Cannot create the specified file.
/opt/lotus/notes/65040/ibmpow/Notes.jar[4]: 0403-057 Syntax error at line 4 : `(' is not expected.
+ echo the jar path
the jar path