delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/13/01:49:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-eSCM-MailFrom: <andre AT dieball DOT net>
Subject: Variable not set correctly in bash
MIME-Version: 1.0
Date: Wed, 13 Apr 2005 07:36:26 +0200
Message-ID: <86B406A17C3F684CB66499B87361FB3802D8FD@mail.dieball.net>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Andre Dieball" <andre AT dieball DOT net>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j3D5nbPq022162

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019