new location (group, CWD)
CD script
PARM dir=“” setvar d “!dir”# “-” means go to prior CWDif d = ‘-’ and bound(save_chdir) then setvar d save_chdirelseif fsyntax(d) = “MPE” then # MPE syntax? if finfo(“./”+d, “exists”) then # HFS dir? setvar d “./” + d elseif finfo(“../”+ups(d), “exists”) then # MPE group? setvar d “../” + ups(d) elseif finfo(ups(d), “exists”) then # MPE dir name? setvar d ups(d) endifendifsetvar save_chdir HPCWDchdir !d
Notes:
- The HPCWD variable contains your current working directory in POSIX syntax. Your current directory is the same as your logon group until you explicitly change it via the CHDIR CI command.
- CD script hierarchy is: 1) dirname as is, 2) ./+dirname, 3) group name (“../”+dirname) 4) uppercase MPE dirname
Note: the CHGROUP command also changes your CWD; whereas, the CHDIR command does not alter your logon group. CHGROUP has security implications since it can give you GU (group user) file access. There are no security implications with CHDIR.
- cd - changes your current directory to the previous directory you’ve CD’d to.
- CD examples: (assume CWD = /SYS/PUB) :cd ../NET # CWD=NET.SYS :cd - # CWD=PUB.SYS :cd /TELESUP/PRVXL # CWD=PRIVXL.TELESUP :cd # CWD=PUB.SYS :cd foo # CWD=/SYS/PUB/foo :cd .. # CWD=PUB.SYS :cd net # CWD=NET.SYS