2008-09-24 50 views
4

我想能说这样的话是否有合理的方法在VMS上实施cd命令?

CD [.fred],并有我的默认目录去那里, 和我迅速的变化来表示的完整路径我的当前位置。

+1

投票你只有唯一(第一)vms标记的问题。 VMS的 – 2008-09-25 03:18:10

+3

yay! :-) – agnul 2008-10-21 21:08:33

回答

3

这里是我的设置:

您需要2个文件(以下类型):在你的SYS $登录godir.com和prompt.com

您可以定义symbole

CD == "@sys$login:godir.com" 

但我建议你使用别的东西...(即SD ==“@ sys $ login:godir.com”)

我修改帮助文本。这是在法国...

你将不得不逃逸caracters重新输入到godir.com 由真正逃入GRAPH_BOUCLE更换ESC:(见godir.com的底部)

然后使用它:

SD ? 
SD a_directory 
... 

希望它有帮助。


这里的prompt.com

$  noeud = f$trnlnm("SYS$NODE") - "::" 
$  if noeud .eqs. "HQSVYC" then noeud = "¥" 
$! 
$  noeud = noeud - "MQO" 
$  def_dir = f$directory() 
$  def_dir = f$extract(1,f$length(def_dir)-2,def_dir) 
$boucle: 
$  i = f$locate(".",def_dir) 
$  if i .eq. f$length(def_dir) then goto fin_boucle 
$  def_dir = f$extract(i+1,f$length(def_dir)-1,def_dir) 
$  goto boucle 
$! 
$fin_boucle: 
$!  temp = "''noeud' ''def_dir' " + "''car_prompt'" 
$  temp = "''noeud'" - 
      + " ''def_dir' " - 
      + "''f$logical(""environnement"")'" - 
      + "''car_prompt'" 
$!  temp = "''noeud'" - 
$!   + "''def_dir'" - 
$!   + "''f$logical(""environnement"")'" - 
$!   + "''car_prompt'" 
$  set prompt="''temp' " 
$! 
$! PROMPT.COM 
$! 

这里的godir.com

$! 
$! GODIR.COM 
$! 
$  set noon 
$  set_prompt = "@sys$login:prompt.com" 
$  if f$type(TAB_DIR_N) .nes. "" then goto 10$ 
$  goto 20$ 
$ INIT: 
$  temp2 = "INIT" 
$ CLEAR: 
$  temp = 0 
$ 
$ INIT2: 
$  temp = temp +1 
$  if temp .gt. TAB_DIR_N then goto INIT3 
$  delete/symb/glo TAB_DIR_'temp' 
$  goto INIT2 
$ 
$ INIT3: 
$  P1 = "" 
$  if temp2 .eqs. "INIT" then goto 20$ 
$  delete/symb/glo TAB_DIR_N 
$  delete/symb/glo TAB_DIR_P 
$  delete/symb/glo TAB_DIR_I 
$  exit 
$ 
$ 20$: 
$  TAB_DIR_N == 1 
$  TAB_DIR_P == 1 
$  TAB_DIR_I == 1 
$  if "''car_prompt'" .eqs. "" then car_prompt == ">" 
$  TAB_DIR_1 == f$parse(f$dir(),,,"device")+f$dir() 
$ 10$: 
$  if P1 .eqs. "" then goto LIST 
$  if P1 .eqs. "?" then goto SHOW 
$  if P1 .eqs. "." then P1 = "[]" 
$  if P1 .eqs. "^" then goto SET_CUR 
$  if (P1 .eqs. "<") .or. (P1 .eqs. ">") .or. - 
      (P1 .eqs. "..") then P1 = "[-]" 
$  if (P1 .eqs. "*") .or. (P1 .eqs. "0") then goto HOME 
$  if (P1 .eqs. "P") .or. (P1 .eqs. "p") then goto PREVIOUS 
$  if (P1 .eqs. "H") .or. (P1 .eqs. "h") then goto HELP 
$  if (P1 .eqs. "S") .or. (P1 .eqs. "s") then goto SET_PROMPT 
$  if (P1 .eqs. "G") .or. (P1 .eqs. "g") then goto SET_PROMPT_GRAPHIC 
$  temp2 = "" 
$  if (P1 .eqs. "~INIT") .or. (P1 .eqs. "~init") then goto INIT 
$  if (P1 .eqs. "~CLEAR") .or. (P1 .eqs. "~clear") then goto CLEAR 
$ 
$!  *** Specification par un numero 
$  temp = f$extract(0,1,P1) 
$  if temp .eqs. "-" then goto DELETE 
$  temp2 = "" 
$boucle_reculer: 
$  if temp .nes. "\" then goto fin_reculer 
$  temp2 = temp2 + "-." 
$  P1 = P1 - "\" 
$  temp = f$extract(0,1,P1) 
$  goto boucle_reculer 
$! 
$fin_reculer: 
$  P1 = temp2 + P1 
$  if (P1 .lts. "0") .or. (P1 .gts. "9") then goto SPEC 
$  temp = f$integer("''P1'") 
$  if temp .eq. 0 then goto HOME 
$  if (temp .lt. 1) .or. (temp .gt. TAB_DIR_N) then goto ERR 
$  TAB_DIR_P == TAB_DIR_I 
$  TAB_DIR_I == temp 
$  goto SET2 
$ 
$ SPEC: 
$!  *** Specification relative de directory 
$ 
$  temp = f$parse("[.''P1']","missing.mis") 
$  DD = f$extract(0,f$locate("]",temp)+1,temp) 
$  if DD .nes. "" then goto SET1 
$ 
$!  *** Specification de directory principal 
$ 
$  temp = f$parse("[''P1']","missing.mis") 
$  DD = f$extract(0,f$locate("]",temp)+1,temp) 
$  if DD .nes. "" then goto SET1 
$ 
$  temp = f$parse("[''P1']","sys$login:missing.mis") 
$  DD = f$extract(0,f$locate("]",temp)+1,temp) 
$  if DD .nes. "" then goto SET1 
$ 
$!  *** Specification exacte de directory 
$ 
$  temp = f$parse(P1,"missing.mis") 
$  if f$locate("]"+P1,temp) .ne. f$length(temp) then goto ERR 
$  if f$locate(".][",temp) .ne. f$length(temp) then temp = temp - "][" 
$  DD = f$extract(0,f$locate("]",temp)+1,temp) 
$!  if DD .eqs. TAB_DIR_'TAB_DIR_I' then goto SHOW 
$  if DD .eqs. TAB_DIR_'TAB_DIR_I' then goto SET2 
$  if DD .nes. "" then goto SET1 
$ 
$  temp = f$parse(P1,"sys$login:missing.mis") 
$  if f$locate("]"+P1,temp) .ne. f$length(temp) then goto ERR 
$  if f$locate(".][",temp) .ne. f$length(temp) then temp = temp - "][" 
$  DD = f$extract(0,f$locate("]",temp)+1,temp) 
$!  if DD .eqs. TAB_DIR_'TAB_DIR_I' then goto SHOW 
$  if DD .eqs. TAB_DIR_'TAB_DIR_I' then goto SET2 
$  if DD .nes. "" then goto SET1 
$ 
$  goto ERR 
$ 
$ HOME: 
$  DD = "SYS$LOGIN" 
$ 
$ SET1: 
$  Set On 
$  On error then goto ERR1 
$  set message/nofac/noid/nosever/notext 
$  Set def 'DD' 
$  dir/output=nl: 
$  set message/fac/id/sever/text 
$  temp = f$parse(f$dir()) - ".;" 
$  if temp .nes. "" then goto SET1F 
$ ERR1: 
$  set message/fac/id/sever/text 
$  temp = TAB_DIR_'TAB_DIR_I' 
$  Set def 'temp' 
$  goto ERR 
$ SET1F: 
$  I = 0 
$ LOOP1: 
$  I = I + 1 
$  if temp .eqs. TAB_DIR_'I' then goto FOUND 
$  if I .lt. TAB_DIR_N then goto LOOP1 
$ 
$  TAB_DIR_N == TAB_DIR_N + 1 
$  TAB_DIR_P == TAB_DIR_I 
$  TAB_DIR_I == TAB_DIR_N 
$  TAB_DIR_'TAB_DIR_I' == temp 
$  goto SHOW 
$ 
$ FOUND: 
$  TAB_DIR_P == TAB_DIR_I 
$  TAB_DIR_I == I 
$  goto SET2 
$ 
$ SET_PROMPT: 
$  car_prompt == "''P2'" 
$  set_prompt 
$  exit 
$ 
$ PREVIOUS: 
$  temp = TAB_DIR_P 
$  TAB_DIR_P == TAB_DIR_I 
$  TAB_DIR_I == temp 
$ 
$ SET_CUR: 
$ SET2: 
$  DD = TAB_DIR_'TAB_DIR_I' 
$  set def 'DD' 
$ 
$ SHOW: 
$  temp = TAB_DIR_'TAB_DIR_I' 
$  ws " ''TAB_DIR_I' * ''temp'" 
$  set_prompt 
$  exit 
$ 
$ LIST: 
$  I = 0 
$ LOOP2: 
$  I = I + 1 
$  temp = TAB_DIR_'I' 
$  if I .eq. TAB_DIR_I then goto L_CUR 
$  if I .eq. TAB_DIR_P then GOTO L_PRE 
$  ws " ''I' = ''temp'" 
$  goto F_LOOP2 
$ L_CUR: 
$  ws " ''I' * ''temp'" 
$  goto F_LOOP2 
$ L_PRE: 
$  ws " ''I' + ''temp'" 
$ 
$ F_LOOP2: 
$  if I .lt. TAB_DIR_N then goto LOOP2 
$  set_prompt 
$ 
$  exit 
$ 
$ DELETE: 
$  P1 = P1 - "-" 
$  temp2 = f$integer("''P1'") 
$ DEL_1: 
$  temp = f$integer("''P1'") 
$  if (temp .lt. 1) .or. (temp .gt. TAB_DIR_N) then goto ERR 
$  if temp .eq. TAB_DIR_I then goto ERR 
$  if temp .lt. TAB_DIR_I then TAB_DIR_I == TAB_DIR_I - 1 
$  if temp .eq. TAB_DIR_P then TAB_DIR_P == TAB_DIR_I 
$  if temp .lt. TAB_DIR_P then TAB_DIR_P == TAB_DIR_P - 1 
$ LOOP3: 
$  if temp .eq. TAB_DIR_N then goto F_LOOP3 
$  temp3 = temp + 1 
$  TAB_DIR_'temp' == TAB_DIR_'temp3' 
$  temp = temp + 1 
$  goto LOOP3 
$ F_LOOP3: 
$  delete/symb/glo tab_dir_'tab_dir_n' 
$  TAB_DIR_N == TAB_DIR_N - 1 
$  if P2 .eqs. "" then goto FIN_DEL 
$  temp2 = temp2 + 1 
$  if temp2 .le. f$integer("''P2'") then goto DEL_1 
$ FIN_DEL: 
$  goto LIST 
$ 
$ ERR: 
$  ws "*** ERREUR ***" 
$  exit 
$ 
$ HELP: 
$  ws " H  Show this menu" 
$  ws " null Show a list of directories" 
$  ws " ?  Show current directory" 
$  ws " < or [-] or" 
$  ws " > or .. Remonte d'un niveau de directory" 
$  ws " * ou 0 Return to SYS$LOGIN" 
$  ws " P  Last directory " 
$  ws " . ou [] Set cureent directory" 
$  ws " ^  Return to next directory" 
$  ws " x  Set def to number x" 
$  ws " -x  Remove the number x" 
$  ws " -x y Remove from x to y" 
$  ws " ddd  Set def to [ddd] or [.ddd] or ddd:" 
$  ws " \ddd Set def to [-.ddd]" 
$  ws " S "">>"" Modify prompt for >>" 
$  ws " ~INIT Initialize to current directory " 
$  ws "   (and delete all others references)" 
$  ws " ~CLEAR Remove all references 
$  ws "" 
$ 
$  exit 
$ 
$ SET_PROMPT_GRAPHIC: 
$  temp = "''P2'" 
$  i=0 
$  car_prompt == "" 
$ GRAPH_BOUCLE: 
$  t=f$extract(i,1,temp) 
$  if (t .eqs. "e") .or. (t .eqs. "E") then t="ESC" 
$  if (t .eqs. "g") .or. (t .eqs. "G") then t="ESC(0" 
$  V° (} .L-_. "N") .-_. (} .L-_. "H") }NL+ }="ESC(B" 
$  car_prompt == car_prompt + t 
$  i = i+1 
$  if i .lts. f$length(temp) then goto GRAPH_BOUCLE 
$ 
$  set_prompt 
$  exit 
4

我的DCL是真的生锈,但不能为SET DEFAULT命名的CD创建一个别名吗?

8

在命令提示只要输入

cd:==set default

。你也可以把这个在你的LOGIN.COM文件,但一定要放$在前面,即

$ cd:==set default

要改变你的提示,以显示你的默认,这样的事情可能会工作提高到一个点

$ set prompt='f$env("default")'

有虽然与VMS提示有最多32个字符,并默认可能长于事实的问题。请参阅this page以解决该问题。

+0

谢谢。 这正是我正在寻找的。 – EvilTeach 2008-09-27 20:54:15

1

HGSD使用它实现了一个SD(简称默认设置)命令。只是谷歌它。这是Hunter Goatley改进版的旧版本。

它不能处理(但)的唯一的东西是具有多个翻译的逻辑。除此之外,它的功能就像一个魅力,你不需要输入完整的目录名称。你甚至可以移动到同一级别的下一个目录。

如果您一次拥有正确的权限,它也可以设置提示,因此您的提示将反映您的默认目录,就像在DOS上的旧版本一样。