Advanced Shell Variable Operations
Variable Deletion and Replacement
Removing Prefix Patterns
Removing the shortest matching prefix pattern using #:
greeting="Hello World, Welcome to Shell"
echo $greeting
greeting_clean=${greeting#*or}
echo $greeting_clean
Removing the longest matching prefix pattern using ##:
greeting_long=${greeting##*or}
echo $greeting_long
String ...
Posted on Fri, 08 May 2026 14:00:10 +0000 by netpants