scripting problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am hoping that someone here can help me with this.  I am running a little
script that backs up some directories for me.  Below is snippet that gets me
into trouble.
---------------------
#!/bin/sh
DIRSTOBACKUP=`/bin/ls -d1 /home/user/*`
for NAMEDIR in ${DIRSTOBACKUP[@]}
do
echo $NAMEDIR
done
---------------------

The problem is that some of the directories have spaces in the names.  When
running the for loop, it will take the new NAMEDIR at the space.  So "Red
Hat" would end up listing as 2 directories, "Red" and "Hat".  Any way around
this?

Thanks
Steve

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux