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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -