Rebol 程式設計/cd
外觀
CD 'path
更改目錄(shell 快捷函式)。
CD 是一個函式值。
- path -- 接受 %file、:variables 和普通單詞(作為目錄)(型別:檔案單詞路徑未設定字串括號)
- catch
cd: func [
"Change directory (shell shortcut function)."
[catch]
'path [file! word! path! unset! string! paren!] "Accepts %file, :variables and just words (as dirs)"
][
if paren? get/any 'path [set/any 'path do path]
switch/default type?/word get/any 'path [
unset! [print what-dir]
file! [change-dir path]
string! [change-dir to-rebol-file path]
word! path! [change-dir to-file path]
] [throw-error 'script 'expect-arg reduce ['cd 'path type? get/any 'path]]
]