"No such file or directory" on simple bash redirection -
here code of mine:
gzip -c $path > /var/www/wiki/backup/$now/$file.gz
i'm gzipping contents of $path
(the path directory), , sending compressed file /var/www/wiki/backup/$now/$file.gz
. $now
contains directory name, $file
name want write compressed file to.
however, on running program, error:
backup.sh: line 20: /var/www/wiki/backup/sunday/extensions.gz: no such file or directory ^$now ^$file
(line 20 line given above)
why program breaking? know sunday/extensions.gz
doesn't exist (although sunday does), that's why i'm asking write it!
full program code:
#!/bin/bash now=$(date +"%a") mkdir -p /var/www/wiki/backups/$now databases=(bmshared brickimedia_meta brickimedia_en brickimedia_customs) locations=("/var/www/wiki/skins" "/var/www/wiki/images" "/var/www/wiki/") db in ${databases[*]} #command passwords , shoodle : done path in ${locations[*]} #echo "" > var/www/wiki/backup/$now/$file.gz file=`echo $path | cut -d/ -f5` echo $path gzip -c $path > /var/www/wiki/backup/$now/$file.gz done
the directory created backups, gzip backup.
mkdir -p /var/www/wiki/backups/$now gzip -c $path > /var/www/wiki/backup/$now/$file.gz
Comments
Post a Comment