shell strip quotes 1

shell strip quotes

temp="${opt%\"}"
temp="${temp#\"}"
echo "$temp"

Here is what the above code is Doing:
1. It’s taking the first argument passed to the script and assigning it to the variable “opt”.
2. It’s removing the first and last characters of the string (the quotes) and assigning the result to the variable “temp”.
3. It’s printing the value of the variable “temp”.

Similar Posts