delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/22/13:22:25

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SARE_SPEC_LEO_DOLLARSa
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: ycweUreswBCK.d0cygTP5tXwHncbOU7YVeVfIxOQoyRMI2IuIKLmUqE-
Message-ID: <4F6B5FAD.5090303@molconn.com>
Date: Thu, 22 Mar 2012 13:21:49 -0400
From: LMH <lmh_users-groups AT molconn DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: some kind of path problem when running bash script from windows shortcut
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

I have recently re-installed windows and cygwin, but my old backup 
script won't anymore when I run it from a windows icon. It runs fine if 
I cd to /usr/local/bin and run it from the command line.

When I run it from the shortcut, I get "file not found" for rsync, date, 
unix2dos, and rm. I have temporarily changed the script to use the full 
path for these, /cygdrive/c/cygwin/bin/date.exe instead of date, but I 
have used this setup for a while and I'm not sure what has changed. Am I 
missing an environment variable or something?

I'm not sure if the problem is in windows or cygwin.

This is the version of the script that doesn't work from the shortcut, 
but does work from the command line.

#!/bin/bash

# generic backup function
function backup {
   echo " " >> $1
   echo " " >> $1
   echo "***** new log entry *****" >> $1
   date >> $logfile_path
   rsync -v -a -r -p -b --suffix=.back -E -t --log-file=$1  $2  $3
   unix2dos $1
}

logfile_path="path_to_logfile"
backup_src_path="path_to_backup_src_loc"
backup_destination_path="path_to_dest_loc"
backup $logfile_path  $backup_src_path  $backup_destination_path

The shortcut is set up as,
Target: C:\cygwin\bin\sh.exe /usr/local/bin/backup.sh
Start in: C:\cygwin\bin

Any suggestions?

LMH

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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