bash4 - How can you search for a char in a string in bash? -
if have string var="root/desktop"
, how can determine whether var
var contains '/'
character?
bash can match against regular expressions =~
, try:
[[ $var =~ "/" ]] && echo "contains slash"
Comments
Post a Comment