我的 bash 脚本中有以下代码:
#!/bin/bash
# vars
BACKUP_DIR= /opt/odoo12/database_backup_test
# create a backup directory
mkdir -p -v "${BACKUP_DIR}"
执行脚本时,出现以下错误:
mkdir: cannot create directory ‘’: No such file or directory
答案1
变量赋值中有一个空格,使其成为空变量,请将其更改为:
BACKUP_DIR=/opt/odoo12/database_backup_test