Check whether an existing file is writable or a new file can be created.

SolidGroundUX DocumentationSolidGroundUX
NL

fn: sgnd_can_append

Purpose

Check whether an existing file is writable or a new file can be created.

Arguments

  • $1 — Target file path.

Side effects

May create missing parent directories during the writability check.

Returns

  • 0 for a writable file/parent; 1 when it cannot be made writable.

Usage

  sgnd_can_append "/tmp/sgnd-demo/log.txt"