List of available environment variables

Here are your specific requests.

scutil --get ComputerName

will print the computer name.

ls /Volumes

will give you the list of volumes.

Here's an example of a script I use that will only run on a machine with a specific serial number: