I want to store the value of the sqlite statement in a variable
backup=$(sqlite3 "/home/miguel/Desktop/SO/ProjetoFinal/Backup_Principal.db" "SELECT periocidade_backup FROM STORAGE WHERE path'$path';")
But when i echo $backup it returns the following:
sqlite3 “/home/miguel/Desktop/SO/ProjetoFinal/Backup_Principal.db” “SELECT periocidade_backup FROM STORAGE WHERE path=’$path’;”
What am I doing wrong?
Advertisement
Answer
the part of your code '$path'
is using a single quote which is literal and show exactly as what is in the quotes, which would not use the variable’s value. using speech marks like the following should work, "'$path'"