In Tcl, we classify some of the variables as special variables and
they have a predefined usage/functionality. The list of specials
variables is listed below.
Examples for using Tcl special variables
Let's see some examples for special variables.Tcl version
#!/usr/bin/tclsh puts $tcl_versionWhen you run the program, you will get a similar output as shown below −
8.6
Tcl Environment Path
#!/usr/bin/tclsh puts $env(PATH)When you run the program, you will get a similar output as shown below −
/home/cg/root/GNUstep/Tools:/usr/GNUstep/Local/Tools:/usr/GNUstep/System/Tools:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/webmaster/.local/bin:/home/webmaster/bin:/usr/local/scriba/bin:/usr/local/smlnj/bin:/usr/local/bin/std:/usr/local/bin/extra:/usr/local/fantom/bin:/usr/local/dart/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/opt/mono/bin:/opt/mono/lib/mono/4.5:/usr/local/bin:.:/usr/libexec/sdcc:/usr/local/icon-v950/bin:/usr/local/mozart/bin:/opt/Pawn/bin:/opt/jdk1.7.0_75/bin:/opt/jdk1.7.0_75/jre/bin:/opt/pash/Source/PashConsole/bin/Debug/
Tcl Package Path
#!/usr/bin/tclsh puts $tcl_pkgPathWhen you run the program, you will get a similar output as shown below −
/usr/lib64/tcl8.6 /usr/share/tcl8.6 /usr/lib64/tk8.6 /usr/share/tk8.6
Tcl Library
#!/usr/bin/tclsh puts $tcl_libraryWhen you run the program, you will get a similar output as shown below −
/usr/share/tcl8.6
Tcl Patch Level
#!/usr/bin/tclsh puts $tcl_patchLevelWhen you run the program, you will get a similar output as shown below −
8.6.3
Tcl Precision
#!/usr/bin/tclsh puts $tcl_precisionWhen you run the program, you will get a similar output as shown below −
0
Tcl Startup File
#!/usr/bin/tclsh puts $tcl_rcFileNameWhen you run the program, you will get a similar output as shown below −
~/.tclshrc
No comments:
Post a Comment