[Code Example] Remove quotes from string using bash script


In this article I will provide you bash script code to remove quotes from string. This code will remove both single ' and double " quotes. It’s ready to use in your projects.

Code Example –


remove_quotes() {
    : "${1//\'}"
    echo "${_//\"}"

remove_quotes "I a'm 'n \"Animal\" lover"

# Output:
# I am n Animal lover

Inspired from Dylan Araps

Live Demo

Demo might not work in private window (incognito)

Sign Up for Our Newsletters

Get only the best articles delivered to your mail

You May Also Like