Sample Header Ad - 728x90

Bash script for sqlite commands

0 votes
1 answer
2850 views
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.
Asked by M.I. (1 rep)
May 8, 2021, 04:03 PM
Last activity: Aug 16, 2022, 07:06 PM