file writable

Tests whether a file can be written.

file writable NAME

Description

Gives 1 when NAME exists and its permissions let a process write it, else 0.

Arguments

ArgumentTypeDefaultDescription
NAMEpathrequiredThe path.

Returns

1 or 0.

Examples

% set f [open n.txt w]; close $f
> file writable n.txt
1

% file writable nope.txt
0

Errors

% file writable
wrong # args: should be "file writable name"
-errorcode TCL WRONGARGS

Facts

Capability
file. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also