|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using CP in bash script
I've got something to this effect: Code:
read -n1 -p "Continue? (y/n)"
if [[ $REPLY == [yY] ]]
then printf "\n" &&
cp -prv $WODI/* $OTHERDRIVE &&
chown -R mail:mail $MAIL/$userdir &&
echo -e "Files copied from '$WODI/' to '$OTHERDRIVE/' and chowned 'vmail:vmail':\n"
else die "\nExiting..."
fi
if [[ ! -L $WODI ]]
then read -n1 -p "Create symlink (ln -s $OTHERDRIVE $WODI)?? (y/n)" &&
[[ $REPLY == [yY] ]] &&
ln -sf $OTHERDRIVE $WODI
else printf "\n"
fi
if [[ -L $WODI ]]
then echo -e "\nSymlink '$OTHERDRIVE' created successfully:\n" &&
ls --color -lA $LISTING | egrep $userdir
else echo -e "\nSymlink '$OTHERDRIVE' does not exist.\n"
fiThis is a clip from a script I'm working on to move courier-imap mail directories (maildir format) to another drive, and then symlink the original location to the new. I'm running into the issue on this line: Code:
cp -prv $WODI/* $OTHERDRIVE cp runs just fine with this command, but it omits all of my maildir folders (folders that being with a period, ie ."Trash") for some reason. Running cp (outside of the script) on the same directory will copy all directories. Also, please tell me of any general scripting errors I may be committing, or anything that doesn't look right. Thanks, guys! |
| Sponsored Links | ||
|
|
|
#2
|
||||
|
||||
|
You need to add another copy command to handle the dot files. Code:
cp -prv $WODI/.[a-zA-Z0-9]* $OTHERDRIVE |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl cgi script to call bash script? | pleonard | Shell Programming and Scripting | 0 | 06-02-2009 01:57 PM |
| Bash script: issue changing directories in script | Breakology | Shell Programming and Scripting | 5 | 05-26-2009 08:47 AM |
| how to make your bash script run on a machine with csh and bash | npatwardhan | Shell Programming and Scripting | 3 | 11-19-2008 03:17 AM |
| passing variable from bash to perl from bash script | arsidh | Shell Programming and Scripting | 10 | 06-04-2008 12:25 PM |
| Why generate "ash and bash" different output for same bash script? | s. murat | Shell Programming and Scripting | 0 | 05-26-2008 07:19 AM |