Horje
bash convert string to uppercase Code Example
bash convert string to uppercase
var=hello #For Bash Version higher than 4.3.33 try these
echo ${var''} #Uppercase whole string
HELLO
echo ${var'} #Uppercase only first char of string
Hello
var2=BYE
echo ${var2,} #Lowercase whole string
bye
echo ${var2,,} #Lowercase only first char of string
bYE
echo $var | tr 'a-z' 'A-Z' #For lower versions of Bash just use tr command
HELLO
bash how to convert text to lowercase or uppercase
# Basic syntax:
tolower(string)
toupper(string)

# Example usage:
awk '{print tolower($0)}' input_file
# This prints every row ($0) converted to lowercase

awk '{print toupper($3)}' input_file
# This would print the third field ($3) converted to uppercase
how to compare a character to uppercase in bash script
echo "enter a char"
read c

if [[ $c == [A-Z] ]];
then
    echo "upper"
elif [[ $c == [a-z] ]];
then
    echo "lower"
else 
    echo "Digit or special symbols!"
fi




Shell

Related
create a virtual environment python conda Code Example create a virtual environment python conda Code Example
running ports in mac Code Example running ports in mac Code Example
install chromedriver linux command line Code Example install chromedriver linux command line Code Example
how to create a vm in anaconda Code Example how to create a vm in anaconda Code Example
remove apache ubuntu Code Example remove apache ubuntu Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11