get first directory in path environment variable code example Example: get first directory in path environment variable echo ${PATH%%:*}