#47 Validating the User Environment

Because people migrate their login, profile, and other shell environment customizations from one system to another, it's not uncommon to have progressive decay in these settings. Eventually, the PATH can include directories that aren't on the system, the PAGER can point to a nonexistent binary, and worse.

A sophisticated solution to this problem is first to check the PATH to ensure that it includes only valid directories on the system, and then to check each of the key helper application settings to ensure that they're either indicating a fully qualified file that exists or that they are specifying a binary that's in the PATH.

The Code

 #!/bin/sh # validator - Checks to ensure that the PATH contains ...

Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.