How to check if a string starts with another string in Bash

1 Answer

0 votes
s="bash programming"

if [[ $s == ba* ]] 
then
  echo "yes";
else
  echo "no"; 
fi



 
# run:
#
# yes
#
 

 



answered Jun 27, 2021 by avibootz

Related questions

1 answer 227 views
1 answer 224 views
1 answer 212 views
1 answer 252 views
2 answers 173 views
1 answer 248 views
...