RosettaCodeData/Task/Take-notes-on-the-command-line/Tcl/take-notes-on-the-command-line.tcl
2023-07-01 13:44:08 -04:00

17 lines
364 B
Tcl

# Make it easier to change the name of the notes file
set notefile notes.txt
if {$argc} {
# Write a message to the file
set msg [clock format [clock seconds]]\n\t[join $argv " "]
set f [open $notefile a]
puts $f $msg
close $f
} else {
# Print the contents of the file
catch {
set f [open $notefile]
fcopy $f stdout
close $f
}
}