I wish to run a bash script that asks for a variable to be then used in a sqlite query.
I have no real experience in scripting, anyway I've tried something like the following but it doesn't work. Doesn't even give an error, just it doesn't show anything.
#!/bin/bash
echo name
read name
sqlite3 /arch.db << 'EOF'
.headers on
select type, number, address from documents where name = '$name';
EOF
I'd appreciate any help.
$name
, not against the variable with the same name – Chris Davies May 08 '21 at 16:10'EOF'
prevent expansion of the heredoc contents, regardless of any quoting used within it – steeldriver May 08 '21 at 17:59