0

I want to add double quotes around my variable string, any advice on how I adapt my code? Simple example below

#!/bin/bash

variable="variable"
echo $variable

I'd like to see the output as

"variable"
Aaron
  • 65
  • 5

1 Answers1

0

Escape the quotes:

echo \"$variable\"

Linus Thiel
  • 38,647
  • 9
  • 109
  • 104
  • 1
    It is a best practice to have an outer-double quote to avoid word-splitting of the contents present – Inian Apr 11 '17 at 12:12