I want to run an ssh command to get the path on a remote machine in order to get the last file and store it into a variable. This is what I've made so far:
#!/bin/bash
database="devdatabase";
echo "Executing Restore Database: '$database'"
filetodump=ssh user@myvirtualmysqlmachine.com 'bash -s'$(ls -1t -d /var/MySQLBackups/prod_mysql/* | grep dump | head -n 1)
echo "This is to test that the srcipt works: '$filetodump'"
How can i get the $filetodump
variable?