How to convert a string to lowercase in Bash

3 Answers

0 votes
s="BASH IS A UNIX SHELL AND COMMAND LANGUAGE"

echo "$s" | awk '{print tolower($0)}'



# run:
#
# bash is a unix shell and command language
#

 



answered Jun 5, 2021 by avibootz
0 votes
s="BASH IS A UNIX SHELL AND COMMAND LANGUAGE"

echo "$s" | tr '[:upper:]' '[:lower:]'



# run:
#
# bash is a unix shell and command language
#

 



answered Jun 5, 2021 by avibootz
0 votes
s="BASH IS A UNIX SHELL AND COMMAND LANGUAGE"

s="${s,,}"

echo "$s" 



# run:
#
# bash is a unix shell and command language
#

 



answered Jun 5, 2021 by avibootz

Related questions

1 answer 348 views
1 answer 333 views
1 answer 325 views
2 answers 733 views
2 answers 489 views
1 answer 350 views
1 answer 309 views
...