public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bash script works on one PC, bombs on another?
@ 2008-04-19  5:05 Dave Burns
  2008-04-19  5:53 ` Brian Dessent
  2008-04-19 14:19 ` Gary Johnson
  0 siblings, 2 replies; 5+ messages in thread
From: Dave Burns @ 2008-04-19  5:05 UTC (permalink / raw)
  To: cygwin

I have a bash script that works on one PC, does not work on another. I
had thought they were configured the same, apparently not!

Here's the script, short and sour:

#!/bin/bash
#invoke audit.sh if results are too old
/usr/bin/find /cygdrive/c/audit.txt -mtime +7 -exec
/cygdrive/c/audit/audit.sh  \;

error message is 'find: missing argument to -exec'. audit.sh is
another script, one that executes okay on both PCs when invoked
directly. Also, if I just type in the command, it works on both PCs.

I googled the error message and cygwin, seems a lot of people
encounter this problem with -exec rm {}\;, not putting in the space.
But this -exec doesn't use {}, has a space in front of \;, and works
fine on a different machine, exact same script. Maybe different
versions of find? Some strange enviroment thing? I re-installed cygwin
from scratch on the one that bombs, no help there.

Thanks in advance,
Dave

--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash script works on one PC, bombs on another?
  2008-04-19  5:05 bash script works on one PC, bombs on another? Dave Burns
@ 2008-04-19  5:53 ` Brian Dessent
  2008-04-20  2:06   ` Dave Burns
  2008-04-19 14:19 ` Gary Johnson
  1 sibling, 1 reply; 5+ messages in thread
From: Brian Dessent @ 2008-04-19  5:53 UTC (permalink / raw)
  To: Dave Burns; +Cc: cygwin

Dave Burns wrote:

> #!/bin/bash
> #invoke audit.sh if results are too old
> /usr/bin/find /cygdrive/c/audit.txt -mtime +7 -exec
> /cygdrive/c/audit/audit.sh  \;

Is the file really wrapped like that or is it all one line?

> Maybe different versions of find?

Um, that's kind of the sort of thing you're supposed to tell us, such as
by attaching 'cygcheck -srv' output or at least the output of 'find
--version'.

> Some strange enviroment thing? I re-installed cygwin
> from scratch on the one that bombs, no help there.

Perhaps you have DOS line endings in one file and not the other, and
find is seeing ";\r" which it treats as an argument to pass to the
exec'd process and not the list terminator.

Brian

--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash script works on one PC, bombs on another?
  2008-04-19  5:05 bash script works on one PC, bombs on another? Dave Burns
  2008-04-19  5:53 ` Brian Dessent
@ 2008-04-19 14:19 ` Gary Johnson
  1 sibling, 0 replies; 5+ messages in thread
From: Gary Johnson @ 2008-04-19 14:19 UTC (permalink / raw)
  To: cygwin

On 2008-04-18, Dave Burns wrote:
> I have a bash script that works on one PC, does not work on another. I
> had thought they were configured the same, apparently not!
> 
> Here's the script, short and sour:
> 
> #!/bin/bash
> #invoke audit.sh if results are too old
> /usr/bin/find /cygdrive/c/audit.txt -mtime +7 -exec
> /cygdrive/c/audit/audit.sh  \;
> 
> error message is 'find: missing argument to -exec'. audit.sh is
> another script, one that executes okay on both PCs when invoked
> directly. Also, if I just type in the command, it works on both PCs.
> 
> I googled the error message and cygwin, seems a lot of people
> encounter this problem with -exec rm {}\;, not putting in the space.
> But this -exec doesn't use {}, has a space in front of \;, and works
> fine on a different machine, exact same script. Maybe different
> versions of find? Some strange enviroment thing? I re-installed cygwin
> from scratch on the one that bombs, no help there.

The script on the machine that bombs appears to have CRLF line 
endings.  Run d2u on the script and it should work fine.

Regards,
Gary


--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash script works on one PC, bombs on another?
  2008-04-19  5:53 ` Brian Dessent
@ 2008-04-20  2:06   ` Dave Burns
  2008-04-20 14:49     ` Mark J. Reed
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Burns @ 2008-04-20  2:06 UTC (permalink / raw)
  To: cygwin

On Fri, Apr 18, 2008 at 6:42 PM, Brian Dessent <brian@dessent.net> wrote:
> Dave Burns wrote:
>
>  > #!/bin/bash
>  > #invoke audit.sh if results are too old
>  > /usr/bin/find /cygdrive/c/audit.txt -mtime +7 -exec
>  > /cygdrive/c/audit/audit.sh  \;
>
>  Is the file really wrapped like that or is it all one line?

One line, wrap is result of emailing somehow.

>
>  > Maybe different versions of find?
>
>  Um, that's kind of the sort of thing you're supposed to tell us, such as
>  by attaching 'cygcheck -srv' output or at least the output of 'find
>  --version'.

Okay, I'm being a  bit lazy. Since I installed these two cygwins
within a couple of weeks of each other, and find is not under intense
development, I thought this was pretty low probability, but I
should've eliminated it.

>
>  > Some strange enviroment thing? I re-installed cygwin
>  > from scratch on the one that bombs, no help there.
>
>  Perhaps you have DOS line endings in one file and not the other, and
>  find is seeing ";\r" which it treats as an argument to pass to the
>  exec'd process and not the list terminator.

I considered that, and edited the file using vim, and retyped that
line. Is that enough to eliminate that possibility? What is a more
straight-forward test of this possibility?

Gary Johnson wrote:
>The script on the machine that bombs appears to have CRLF line
>endings.  Run d2u on the script and it should work fine.

Ah! Thanks, I'll try that.

Dave

--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bash script works on one PC, bombs on another?
  2008-04-20  2:06   ` Dave Burns
@ 2008-04-20 14:49     ` Mark J. Reed
  0 siblings, 0 replies; 5+ messages in thread
From: Mark J. Reed @ 2008-04-20 14:49 UTC (permalink / raw)
  To: cygwin

On Sat, Apr 19, 2008 at 4:30 PM, Dave Burns <tburns@hawaii.edu> wrote:
>  I considered that, and edited the file using vim, and retyped that
>  line. Is that enough to eliminate that possibility?

Nope, vim will happily preserve the line-ending convention of the
file.  Look for an indicator in the status line - "(text)" or "(text
mode)" or "(DOS)" or something, don't recall offhand. That means it
has CRLF's.  You can fix it by typing :set notextmode and then writing
it back out.  Or, as Gary said, run d2u on it.

-- 
Mark J. Reed <markjreed@gmail.com>

--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-20 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-19  5:05 bash script works on one PC, bombs on another? Dave Burns
2008-04-19  5:53 ` Brian Dessent
2008-04-20  2:06   ` Dave Burns
2008-04-20 14:49     ` Mark J. Reed
2008-04-19 14:19 ` Gary Johnson

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).