How do I remove a character from a string in bash?

How do I remove a character from a string in bash?
Answer
To remove the last n characters of a string, we can use
the parameter expansion syntax ${str::-n} in the Bash shell. -n is the number of characters we need to remove from the end of a string.
 

Tìm kiếm

Back
Top