Tuesday, August 23, 2022

How to extract hostname withouth FQDN in a shell variable

Taken from https://stackoverflow.com/questions/36151206/hostname-variable-in-shell-script-not-fqdn and really useful:
export HOST=${HOSTNAME%%.*}

No comments:

Post a Comment