Skip to content

Instantly share code, notes, and snippets.

@mredar
Created February 25, 2014 22:01
Show Gist options
  • Save mredar/9218800 to your computer and use it in GitHub Desktop.
Save mredar/9218800 to your computer and use it in GitHub Desktop.
Substring in bash
#!/bin/bash
zone='us-east-1bx'
len=${#zone}-1
region=${zone:0:$len}
echo "REGION $region"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment