#!/bin/bash # Return host the current directory is stored on DIR=$(readlink -f .) DIRS=($(echo $DIR | tr '/' ' ')) if echo $DIR | grep '^/net' >/dev/null ; then echo ${DIRS[1]} else echo localhost fi