public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: LMH <lmh_users-groups@molconn.com>
To: cygwin@cygwin.com
Subject: some kind of path problem when running bash script from windows shortcut
Date: Thu, 22 Mar 2012 17:22:00 -0000	[thread overview]
Message-ID: <4F6B5FAD.5090303@molconn.com> (raw)

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

             reply	other threads:[~2012-03-22 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22 17:22 LMH [this message]
2012-03-22 17:37 ` Adam Dinwoodie
2012-03-22 17:50   ` LMH
2012-03-22 18:40     ` Adam Dinwoodie
2012-03-22 18:47       ` LMH
2012-03-23 14:05     ` Andrey Repin
2012-03-23 15:50       ` LMH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F6B5FAD.5090303@molconn.com \
    --to=lmh_users-groups@molconn.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).