Bash Parameter Expansion

var="george.com"
echo ${var#*e}
.com
echo ${g#ge}
orge.com
echo ${g%.*}
george
echo ${g%rge*}
geo
echo ${var#*\#}
..er*##.com
echo ${var##*\#}
.com
echo ${var%\#*}
george#..er*#
echo ${var%%\#*}
george

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
george udosen

george udosen

45 Followers

DevOps | FullStack developer | Python::Flask | GCP Cloud Certified | AWS & AZURE Cloud Savy | Linux Sysadmin | Google IT Support