Reputation: 85
Okay, this should be easy but I tried braces and brackets to get this to work but it has been too long since I did UNIX shell scripting.
I want to do quick backups using TAR of just selected files in a few directories, only those with PHP, HTML, CSS, or BMP extensions. Who has the fix?
#!/bin/bash
cd ~ ; x="public_html/gpp"
targpp="tar -cvf gppbasic.`date +%Y%m%d.%k%M`.tar $x/*.[php|html|css|bmp]"
$targpp ; ls -l gppbasic*.tar
Upvotes: 0
Views: 207
Reputation: 4267
try curly bracket
tar -cvf gppbasic.$(date +%Y%m%d.%k%M).tar $x/*.{php,html,css,bmp}
Upvotes: 2