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 354 views
1 answer 349 views
1 answer 317 views
1 answer 366 views
2 answers 358 views
1 answer 370 views
...