Sunday, November 27, 2022

Get length of a string in bash shell script

#!/bin/bash

# Create a new string

mystring="lets count the length of this string"

i=${#mystring}

echo "Length: $i"


Source:https://www.hostinger.in/tutorials/bash-script-example

No comments:

Post a Comment