Bash /
ManipulatingStringsString lengthTo determine a string's length, the shortest is: Trimming Strings
To remove the selection, simply leave CombinationsThe above can be used together to obtain the substring between varTrimFront=${var/*pattern1/} varTrimFrontAndBack=${varTrimFront/%\pattern2*/} echo $varTrimFrontAndBack |