Remove Double Quote from a String
The sed command line utility helps to easily handle this. A single-line sed command can remove quotes from the start and end of the string. The above sed command executes two expressions against the variable value.
The first expression ’s/^"//’ will remove the starting quote from the string. Second expression ’s/"$//’ will remove the ending quote from the string.
Remove Double Quote and Store Output
The result will be printed on the terminal. You can also save the result to a variable and or redirect output to a file. The below commands will help you to remove double quotes and store output to the same or different variable. Even you can store the result in a file. like:
Conclusion
This tutorial helped you to remove the start and ending double quotes from a string stored in a variable using shell script.
