In some situations I would like to store complete commands and output from terminal sessions in a MySQL database.
Ideally I would just copy the command and output from the terminal to my clipboard then just paste into a simple bash script that would update the relevant field.
I have experimented with using the read function in bash, see below. However when pasting multiple lines into the read it does not parse the line breaks correctly.
#!/bin/bash
read -e -p "name: " name
read -e -p "output: " ouput
mysql -u example@localhost << EOF
use database;
insert into table (name, output) values('$title', '$output');
EOF
I know this is not elegant, but would really useful reference for me in the future.
Perhaps somebody could shed some light on a better way to get this done...
Thanks in advance,