我需要恢复在主文件夹中创建的最后一个 Mysql 数据库文件,但在尝试运行下一个命令时出现错误gunzip < /home/$('ls /home -t | head -1') | mysql -u root -p123456 mydatabase -h localhost
如果我替换该命令运行正常$('ls -t | head -1')
用于备份文件的名称,但我需要每天在 CronJob 上运行它。
我不断收到同样的错误:
-bash: ls /home -t | head -1: No such file or directory
最佳答案
为什么要在命令中加上单引号?
如果您更换应该可以工作
/home/$('ls /home -t | head -1')
和/home/$(ls /home -t | head -1)
关于linux - 恢复文件夹中最后一个 MySQL 备份文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72537856/