Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

TCL - Changing Working Directory - cd, pwd


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, and cd 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 {
puts

set c_files [glob -nocomplain c*]


"[format "%-15s %-20s " $name [pwd]]"
}


}


This post first appeared on VLSI WORLD, please read the originial post: here

Share the post

TCL - Changing Working Directory - cd, pwd

×

Subscribe to Vlsi World

Get updates delivered right to your inbox!

Thank you for your subscription

×