|
|
|
|
|
by cvccvroomvroom
941 days ago
|
|
That's a pointless example. [ "$foo" = bar ] && echo Yes
For substring matches, [ and * globs are generally good enough. [ "$bar" = extra* ] && echo '$bar began with extra'
Bash's regex dialect is primitive and rarely worth fussing over. For anything complicated, use another tool be it grep, awk, perl, or such. There are diminishing returns of obsessing over doing everything in bash when a complicated task demands more capabilities suitable to another tool with greater reusability, modularity, and intrinsic types. |
|