edit: Changes to handle non-existent files.
Use local instead of typeset since dash, bash, and zsh all support local.
edit: Fix sudo definition.