Updated 2013-08-15 01:35:06 by RLE

chmod (CHange MODe) is one of the basic Unix command-line tools. It is also the name of a TclX command with the same functionality. In newer Tcl versions, one can use file attributes (with option -permissions) to set this information.

A use of the Unix command that is often needed is
  chmod u+x myscript.tcl

or
  chmod a+x myscript.tcl

to make the Tcl script myscript.tcl executable (for just you or for all users, respectively). This assumes the script contains something like the exec magic that lets the kernel figure out how to run this script, though.

The TclX package's version of this command is documented as follows:
chmod ?-fileid? mode filelist

Set permissions of each of the files in the list filelist to mode, where mode is an absolute numeric mode or symbolic permissions as in the UNIX chmod(1) command. To specify a mode as octal, it should be prefixed with a "0" (e.g., 0622).

If the option -fileid is specified, filelist is a list of open file identifiers rather than a list of file names. This option is not available on all Unix systems. Use the infox have_fchmod command to determine if this functionality is available.

The chmod command is not available on Windows.