This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

some kind of path problem when running bash script from windows shortcut


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]