Tcl also supports commands to change and display the current working directory.
These are:
- cd ?dirName?
- Changes the current directory to dirName (if dirName is given, or to the $HOME directory if dirName is not given. If dirName is a tilde (~,
cd
changes the working directory to the users home directory. If dirName starts with a tilde, then the rest of the characters are treated as a login id, andcd
changes the working directory to that user's $HOME. - pwd
- Returns the current directory.
Example
set dirs [list TEMPDIR]uts "[format "%-15s %-20s " "FILE" "DIRECTORY"]"p foreach dir $dirs { catch {cd $dir}foreach name $c_files { putsset c_files [glob -nocomplain c*] "[format "%-15s %-20s " $name [pwd]]" }}
No comments:
Post a Comment