This page is part of the Airplug documentation related to Tcl/Tk.
Back to the Tcl/Tk documentation page /
Back to the Airplug documentation page
Environment variables, command line…
#!/usr/bin/tclsh # interacting with the environment # Predefined variables puts stdout "home = $env(HOME)" puts stdout "tcl version = [info tcl]" # Executing shell commands puts stdout "ls = [exec ls]" # Command line arguments # $argv is a liste puts stdout "all the command line arguments = $argv" puts stdout "second command line argument = [lindex $argv 1]" # Dealing with variables puts stdout "---" set MyNumber 5 puts stdout "list of all variables, including MyNumber = [info var]" puts stdout "---" # Unsetting a variable unset MyNumber puts stdout "list of all variables, without MyNumber = [info var]"
This output has been produced with the command: ./example-08.txt a b c d
home = /home/ducourth ls = example-08.tcl all the command line arguments = a b c d second command line argument = b tcl version = 8.4 --- list of all variables, including MyNumber = tcl_rcFileName tcl_version argv0 argv tcl_interactive errorCode auto_path errorInfo MyNumber env tcl_pkgPath tcl_patchLevel argc tcl_libPath tcl_library tcl_platform --- list of all variables, without MyNumber = tcl_rcFileName tcl_version argv0 argv tcl_interactive errorCode auto_path errorInfo env tcl_pkgPath tcl_patchLevel argc tcl_libPath tcl_library tcl_platform
<br/>
This page is part of the Airplug documentation related to Tcl/Tk.
Back to the Tcl/Tk documentation page /
Back to the Airplug documentation page