Skip to content

Path

Index

path::remove

Remove all occurrences of a directory from PATH. When PATH equals exactly the directory, clears PATH without invoking awk/sed. Uses awk -v (not --assign) because mawk — the default awk on Debian/Ubuntu — does not accept --assign. -v is POSIX and works on every awk implementation.

Arguments

  • $1 (directory): path to remove

path::append

Append a directory to PATH (removing any existing occurrence first to avoid duplicates). When PATH is empty, sets PATH to just the directory — no stray leading colon.

Arguments

  • $1 (directory): path to append

path::prepend

Prepend a directory to PATH (removing any existing occurrence first to avoid duplicates). When PATH is empty, sets PATH to just the directory — no stray trailing colon.

Arguments

  • $1 (directory): path to prepend