One Liner Script To Check If Xsan Is Installed

The following will tell you whether Xsan has been installed on a client system. Here we’re checking if the file exists using the [] for a file (I always quote paths that aren’t variables when doing this type of thing) and and then echoing a response that it does.

[ -f "/Library/Preferences/Xsan/uuid" ] && echo "Xsan is installed"

If the file exists, we could also perform some other tasks or use an else and make changes, like copying an authorization and fsnameservers file into the directory when installing StorNext clients on OS X. The way I would likely do this, if I were saying if the uuid file doesn’t exist, do a task would be:

[ | -f "/Library/Preferences/Xsan/uuid" ] && echo "Xsan is not installed"

In the above example, placing the pipe in front acts as a negative operator, so these two lines are basically the opposite of one another.

 

Comments are closed.