Answers for "bash check if string starts with substring"

0

bash check if string starts with substring

# Original source: Advanced Bash Scripting Guide (http://tldp.org/LDP/abs/html/comparison-ops.html)
# The == comparison operator behaves differently within a double-brackets
# test than within single brackets.

[[ $a == z* ]]   # True if $a starts with a "z" (wildcard matching).
[[ $a == "z*" ]] # True if $a is equal to z* (literal matching).
Posted by: Guest on September-13-2021

Code answers related to "bash check if string starts with substring"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language