This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Variable not set correctly in bash
- From: "Andre Dieball" <andre at dieball dot net>
- To: <cygwin at cygwin dot com>
- Date: Wed, 13 Apr 2005 07:36:26 +0200
- Subject: Variable not set correctly in bash
Gents
I'm running some rsync scripts in order to backup my Linux machine to my
windows machine (unfortunately, the windows one is the one with more
capacity)
These scripts actually run fine when running in "standard" Linux
environments (using the between linux's as well), but for what ever
reason, I have a problem with initializing a variable, when running
these scripts under cygwin.
The code snippet in question is the following:
---cut---
for OLD in 6 5 4 3 2 1 ; do
if [ -d $DATA_PATH/$SERVER/daily.$OLD ] ; then
NEW=$[ $OLD + 1 ]
# Datum sichern
touch $DATA_PATH/timestamp -r
$DATA_PATH/$SERVER/daily.$OLD
mv $DATA_PATH/$SERVER/daily.$OLD
$DATA_PATH/$SERVER/daily.$NEW
# Datum zurueckspielen
touch $DATA_PATH/$SERVER/daily.$NEW -r
$DATA_PATH/timestamp
fi
done
---cut---
The Variable $OLD is not set properly. Issuing the command "touch
$DATA_PATH/timestamp -r $DATA_PATH/$SERVER/daily.$OLD" then creates a
directory "daily" instead of "daily.(something between 1 and 7)"
This of course causes the next line to fail as well.
As I mentioned, under "normal" Linux, the same script runs just fine.
Anyone with any useful hints/tips?
Thanks a lot in advance.
Andre
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/