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 243 views
1 answer 228 views
1 answer 233 views
2 answers 587 views
2 answers 362 views
1 answer 259 views
1 answer 215 views
...