OS/2 tricks: setlocal/endlocal and beginlibpath/endlibpath
setlocal/endlocal is a command to save current environmental variabls and to restore them, again. So they are usually at beginning and at end of a batch file or of a rexx file, respectively.
However, there is a pitfall here. setlocal/endlocal do not work with beginlibpath/endlibpath. Because beginlibpath/endlibpath are not real environmental variables. Instead, command interpreter such as CMD and 4OS2, treat them like environmental variables.
Because of this, if you modify beginlibpath/endlibpath in setlocal/endlocal block, then original beginlibpath/endlibpath are not resotred after endlocal.
This is observed on both CMD and 4OS2. So you should use a workaround. It's simple. Just backup beginlibpath/endlibpath and restore them manually.
Use this pattern.
// ----- 2014/09/24
LIBPATHSTRICT is not restored, too.
//
However, there is a pitfall here. setlocal/endlocal do not work with beginlibpath/endlibpath. Because beginlibpath/endlibpath are not real environmental variables. Instead, command interpreter such as CMD and 4OS2, treat them like environmental variables.
Because of this, if you modify beginlibpath/endlibpath in setlocal/endlocal block, then original beginlibpath/endlibpath are not resotred after endlocal.
This is observed on both CMD and 4OS2. So you should use a workaround. It's simple. Just backup beginlibpath/endlibpath and restore them manually.
Use this pattern.
1 2 3 4 5 | setlocal set oldb=%beginlibpath% rem your codes set beginlibpath=%oldb% endlocal |
// ----- 2014/09/24
LIBPATHSTRICT is not restored, too.
//
댓글
댓글 쓰기