If I have a string var="root/Desktop", how can I determine whether var var contains a '/' character?
Bash can match against regular expressions with =~, try:
[[ $var =~ "/" ]] && echo "contains a slash"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With