Use tr to delete "
:
echo "$opt" | tr -d '"'
NOTE: This does not fully answer the question, removes all double quotes, not just leading and trailing. See other answers below.
More Related Contents:
- How to check if a string contains a substring in Bash
- How to use sed/grep to extract text between two words?
- Bash tool to get nth line from a file
- How do I use variables in single quoted strings?
- Extract substring in Bash
- Better way to rename files based on multiple patterns
- Multi-line string with extra space (preserved indentation)
- Replace whole line containing a string using Sed
- How to echo “$x_$y” in Bash script?
- Convert specified column in a multi-line string into single comma-separated line
- Test for empty string with X”” [duplicate]
- Extract version number from a string
- Split bash string by newline characters
- Some troubles with using sed and awk [closed]
- What does 2>&1 mean here?
- Replace a string in shell script using a variable
- Bash command line and input limit
- What does $@ mean in a shell script?
- Checking from shell script if a directory contains files
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- Reading a space-delimited string into an array in Bash
- Piping tail output though grep twice
- How to run a shell script on a Unix console or Mac terminal?
- How to use sed to remove the last n lines of a file
- How to go to each directory and execute a command?
- How to split a file into equal parts, without breaking individual lines? [duplicate]
- How can I convert tabs to spaces in every file of a directory?
- How to match a single quote in sed
- Difference between shell and environment variables
- What’s the point of eval/bash -c as opposed to just evaluating a variable?