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 355 views
1 answer 340 views
1 answer 331 views
2 answers 738 views
2 answers 495 views
1 answer 357 views
1 answer 315 views
...