I need to extract part of the string before the last opt in the string:
NDS=/opt/novell/opt/eDirectory/opt/abc
I want just the /opt/novell/opt/eDirectory/ part
I used NDSHOME=${NDS%opt*}
but I am getting bad substitution on Solaris 10, that is using the Bourne shell,
although this script works fine on Linux and AIX.
Can somebody find a solution to this??
Solaris’ /bin/sh is notoriously not Posix compatible.
You could try the following workaround with
sedNote: Normally I would use
$()instead of backtics for command substitution, but I don’t think those work on Solaris either.Edit
Changed it so that
optwill not match intra-word boundaries