Skip to content

Instantly share code, notes, and snippets.

@BenBroide
Last active January 8, 2017 02:04
Show Gist options
  • Select an option

  • Save BenBroide/e152556a22b0d306f1a128377f638454 to your computer and use it in GitHub Desktop.

Select an option

Save BenBroide/e152556a22b0d306f1a128377f638454 to your computer and use it in GitHub Desktop.
Hostname cloud9
# Recives hostname : batz-bar-taxi-coupons-4241432
# returns: batz-bar-taxi-coupons
IFS='-' read -r -a host_name_array <<< "$(hostname)"
unset 'host_name_array[${#host_name_array[@]}-1]'
IFS=$'-'; echo "${host_name_array[*]}" ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment