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 227 views
1 answer 209 views
1 answer 222 views
2 answers 568 views
2 answers 347 views
1 answer 244 views
1 answer 202 views
...