![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another variable question, I think | NycUnxer | UNIX for Dummies Questions & Answers | 2 | 02-28-2008 08:30 PM |
| VAriable Question | rjsha1 | Shell Programming and Scripting | 4 | 02-07-2006 05:03 AM |
| Question about breaking up a variable | krism | Shell Programming and Scripting | 2 | 09-19-2005 01:08 PM |
| Problem with initializing DirectFB by Links | eugrus | Linux | 0 | 01-15-2005 10:13 AM |
| Re-initializing startup files without rebooting | DrScar | UNIX for Dummies Questions & Answers | 3 | 08-20-2001 07:14 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Question on Initializing the Variable
What i am trying to do is cd to my directory first. If any of that folder contains "volcano" folder then create the same directory structure in the remote machine "lexus". This is what i am doing.
Code:
LOCAL_LOG_FILE="logging.log"
DEST_DIR="/test/ferrari/testing"
cd /home/mike/
for dir in $DATA_DIR; do
if [ -d ${dir}/"volcano" ]; then
/usr/local/bin/ssh -l abc lexus "mkdir -p 777 $DEST_DIR/$dir" >>$LOCAL_LOG_FILE 2>&1
scp -r ${dir}/"volcano" lexus:$DEST_DIR/${dir}/
fi
done
exit 0
/test/ferrari/testing/joe/volcano/abc.txt /test/ferrari/testing/mike/volcano/xyz.txt But if i just put that "cd /home/mike" in a variable it creates the home directories also :- Code:
DATA_DIR="/home/mike/*"
DEST_DIR="/test/ferrari/testing"
for dir in $DATA_DIR; do
if [ -d ${dir}/"volcano" ]; then
/usr/local/bin/ssh -l abc lexus "mkdir -p 777 $DEST_DIR/$dir" >>$LOCAL_LOG_FILE 2>&1
scp -r ${dir}/"volcano" lexus:$DEST_DIR/${dir}/
fi
done
exit 0
/test/ferrari/testing/home/mike/joe/volcano/abc.txt /test/ferrari/testing/home/mike/joe/volcano/xyz.txt Instead it should create :- /test/ferrari/testing/joe/volcano/abc.txt /test/ferrari/testing/mike/volcano/xyz.txt Can someone tell me why this is happening? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Quote:
Code:
for dir in /home/mike; do Code:
for dir in `ls $DATA_DIR`; do |
||||
| Google The UNIX and Linux Forums |