Finding relative path of a file

I have to relatively get the path of a file to use it in the script.

The directory structure is /export/opt/XTools/ and under this there are several version directories - 1.0_A0, 1.0_A1, 1.0_A2 etc.,. The actual file is under these directories: installscript.sh

My script should pickup the file from the latest version by itself. In the below script, the script should take A2 by checking the directory path.

My script:
#!/bin/ksh
#
./export/opt/XTools/1.0_A2/installscript.sh

Please advise.

Thanks
Chiru

Try:
file=$(ls -t /export/opt/XTools/*/install.sh | sed 1q)

# $(ls -td 1.0_A* | head -1)/installscript.sh

An observation, that doesn't ensure the latest script, only the latest directory The version posted by Perderabo takes the latest file.

You should take whichever does what you want but choosing the wrong one could make things behave differently than you expect.

set -- $( ls -t ./export/opt/XTools/*/installscript.sh )
$1