I'm writing a script to automatically create a backup of my filesystem which I will then burn to a cd. Everything except this works.
BACKUP_NAME="phoenix"
BACKUP_DIR="/$BACKUP_NAME"
CREATE_FS="find . -mount -depth -print0 | cpio -apdmu0 $BACKUP_DIR"
echo "$CREATE_FS"
cd /
$CREATE_FS
Yields this:
find . -mount -depth -print0 | cpio -apdmu0 /phoenix
find: paths must precede expression
Usage: find [path...] [expression]
Very strange I say.
If I run just this: "find . -mount -depth -print0" outside of the script it does what you would expect, flooding my screen with gobs and gobs of filenames.
What do you think? It actually worked fine inside the script...until I moved the command to a variable name. Why is it behaving differently now?
BACKUP_NAME="phoenix"
BACKUP_DIR="/$BACKUP_NAME"
CREATE_FS="find . -mount -depth -print0 | cpio -apdmu0 $BACKUP_DIR"
echo "$CREATE_FS"
cd /
$CREATE_FS
Yields this:
find . -mount -depth -print0 | cpio -apdmu0 /phoenix
find: paths must precede expression
Usage: find [path...] [expression]
Very strange I say.
If I run just this: "find . -mount -depth -print0" outside of the script it does what you would expect, flooding my screen with gobs and gobs of filenames.
What do you think? It actually worked fine inside the script...until I moved the command to a variable name. Why is it behaving differently now?