Group Listing of Commands

This section briefly lists all Tcl commands, grouped logically by function.

Control Statements

break

Abort innermost containing loop command.

case

Obsolete, see switch.

continue

Skip to next iteration of innermost containing loop command.

exit

Terminate process.

for

Loop based on an expression.

foreach

Loop over each element of a list.

if

Conditional evaluation.

return

Return from procedure.

switch

Evaluation based on pattern match.

while

Loop based on a condition being true.

File Manipulation

file atime

Return file access time.

file mtime

Return file modification time.

file attributes

Set or get platform-dependent file attributes.

file copy

Make copy of a file or directory.

file delete

Remove file or directory.

file dirname

Return directory portion of pathname.

file executable

Return 1 if file is executable, 0 otherwise.

file exists

Return 1 if file exists, 0 otherwise.

file isdirectory

Return 1 if file is a directory, 0 otherwise.

file isfile

Return 1 if file is a regular file, 0 otherwise.

file owned

Return 1 if file is owned by current user, 0 otherwise.

file readable

Return 1 if file is readable by current user, 0 otherwise.

file writable

Return 1 if file is writable by current user, 0 otherwise.

file extension

Return characters after and including last period.

file join

Combine arguments with path separator to form pathname.

file mkdir

Create a directory.

file nativename

Return platfor m-specific filename.

file pathtype

Return type of path: absolute, relative, or volumerelative.

file readlink

Return value of symbolic link.

file rename

Rename file, moving if necessary.

file rootname

Return characters before last period in pathname.

file size

Return file size in bytes.

file split

Split pathname into separate elements.

file stat

Store file information in an array variable.

file lstat

Same as file stat, but return information for target of symbolic links.

file tail

Return characters in name after last file separator.

file type

Return type of file: file, directory, characterSpecial, blockSpecial, fifo, link, or socket.

file volume

Return list of mounted volumes or drive letters.

Tcl Interpreter Information

info args

Return information on procedure arguments.

info body

Return body of procedure.

info cmdcount

Return count of commands invoked by interpreter.

info commands

Return list of Tcl commands.

info complete

Return 1 if command is complete.

info default

Return default procedure argument.

info exists

Return 1 if variable exists.

info globals

Return list of global variables.

info hostname

Return machine hostname.

info level

Return procedure stack level or stack arguments.

info library

Return name of library directory.

info loaded

Return list of loaded packages.

info locals

Return list of local variables.

info nameofexecutable

Return name of application.

info patchlevel

Return Tcl patch level.

info procs

Return list of Tcl procedures.

info script

Return name of file being evaluated.

info sharedlibextension

Return file extension for shared libraries.

info tclversion

Return Tcl version.

info vars

Return list of local and global variables.

Lists

concat

Concatenate (join) lists into a new list.

join

Join lists into a string.

lappend

Append elements to list.

lindex

Retrieve element from list.

linsert

Insert element into list.

list

Create a list.

llength

Number of elements in list.

lrange

Return sequential range of elements from list.

lreplace

Replace elements in list.

lsearch

Search list for element.

lsort

Sort elements of list.

split

Split a string into a list.

Arrays

array anymore

Return 1 if more array elements left during search.

array donesearch

Terminate array search.

array exists

Return 1 if array exists.

array get

Return list of array element names and values.

array names

Return list of array element names.

array nextelement

Return name of next element during search.

array set

Set array values.

array size

Return number of elements in array.

array startsearch

Initialize array search operation.

parray

Print array.

Strings

append

Append values to variable.

binary

Insert and extract fields from binary strings.

format

printf( )-style string formatting.

regexp

Regular expression pattern matching.

regsub

Regular expression string substitution.

scan

sscanf()-style string parsing.

string compare

Lexical string comparison.

string first

Search for first occurrence of substring.

string index

Return character from string.

string last

Search for last occurrence of substring.

string length

Return number of characters in string.

string match

Compare strings using shell glob pattern matching.

string range

Return range of characters from string.

string tolower

Convert to lowercase.

string toupper

Convert to uppercase.

string trim

Remove leading and trailing characters.

string trimleft

Remove leading characters.

string trimright

Remove trailing characters.

string wordend

Return end position of word in string.

string wordstart

Return start position of word in string.

subst

Backslash, command, variable substitutions.

Input/Output

close

Close channel.

eof

Check for end of file.

fblocked

Return 1 if last operation exhausted available input.

fconfigure

Set or get I/O options.

fcopy

Copy from one channel to another.

fileevent

Set file event handler.

flush

Flush buffered output.

gets

Read line of input.

open

Open channel.

puts

Write to channel.

read

Read from channel.

seek

Set the access position.

socket

Open network connection.

tell

Get access position.

System Interaction

cd

Change working directory.

clock

Time functions.

exec

Invoke subprocesses.

glob

Filename pattern matching.

pid

Return process IDs.

pwd

Return current working directory.

Command History

history

Same as history info.

history add

Add command to history list.

history change

Change command in history list.

history clear

Clear history list.

history event

Return event.

history info

Return formatted history list.

history keep

Get or set size of history list.

history nextid

Return next event number.

history redo

Execute command from history list.

The tclsh program also supports the following csh-style history commands:

!!

Repeat last command.

!event

Repeat command, matching a number or name.

^old ^new

Repeat command, substituting occurrences of regular expression old with new.

Multiple Interpreters

interp alias

Create, delete, or return definition of an interpreter alias.

interp aliases

Return list of command aliases.

interp create

Create slave interpreter.

interp delete

Delete slave interpreters.

interp eval

Evaluate command using slave interpreter.

interp exists

Test if slave interpreter exists.

interp expose

Make hidden command visible to slave interpreter.

interp hidden

Return list of hidden commands.

interp hide

Hide exposed command.

interp invokehidden

Invoke hidden command.

interp issafe

Return 1 if interpreter is safe.

interp marktrusted

Mark interpreter as trusted.

interp share

Share I/O channel between interpreters.

interp slaves

Return list of slave interpreters.

interp target

Return list describing target interpreter for an alias.

interp transfer

Move I/O channel to another interpreter.

Packages

package forget

Remove information about package from interpreter.

package ifneeded

Tell interpreter how to load a package.

package names

Return list of available packages.

package provide

Indicate that package is present in interpreter.

package require

Indicate that package is needed.

package unknown

Supply command to load packages when not found.

package vcompare

Compare package version numbers.

package versions

Return list of package versions available.

package vsatisfies

Return package version compatibility information.

pkg_mkIndex

Build index for automatic loading of packages.

Miscellaneous Commands

after

Execute a command after a time delay.

auto_execok

Return path of executable.

auto_load

Autoload Tcl command.

auto_mkindex

Generate tclIndex file.

auto_reset

Reset autoloading cache.

bgerror

Process background errors.

catch

Evaluate script and trap exceptional returns.

error

Generate an error.

eval

Evaluate a Tcl script.

expr

Evaluate an expression.

global

Access global variables.

incr

Increment the value of a variable.

load

Load machine code and initialize new commands.

namespace

Create and manipulate contexts for commands and variables.

proc

Create a Tcl procedure.

rename

Rename or delete a command.

set

Read and write variables.

source

Evaluate a file or resource as a Tcl script.

time

Time the execution of a script.

trace

Trace variable access.

unknown

Handle attempts to use nonexistent commands.

unset

Delete variables.

update

Process pending events and idle callbacks.

uplevel

Execute a script in a different stack frame.

upvar

Create link to variable in a different stack frame.

variable

Create and initialize a namespace variable.

vwait

Process events until a variable is written.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset