This is the mail archive of the cygwin@cygwin.com 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]

Re: associating(?) .sh scripts


Hi, all --

Sorry I couldn't get to this yesterday...  Anyone remember where we were?  :-)

...and then Andrew Markebo said...
% 
% / David T-G <davidtg-cygwin@justpickone.org> wrote:
% | 
% | I have a shell script "meta-play.sh" which I run to collect metadata
% | after I burn an MP3 CD.  I cd into the source directory and run
% | 
% |   ../meta-play.sh cdname
% 
% >From where? The bash script?? command/cmd?? 

From a bash prompt which was fired off directly from a Start menu shortcut
that calls bash.exe.


% 
% What does the first lines of meta-play.sh look like, what about
% dos/unix newlines.. 

When I ran file on it this evening I was surprised to find that it had
CR/LF endings and so I fixed that, but that didn't cut it.

  BASH-2.05a$ ./meta-play.sh
  BASH: ./meta-play.sh: No such file or directory
  BASH-2.05a$ !fil
  file ./meta-play.sh
  ./meta-play.sh: ASCII text
  BASH-2.05a$ head -5 !$
  head ./meta-play.sh

  [ -z "$1" ] && { echo "" ; echo "Whoa; gimma a disc ID like calix-01" ; echo "" ; exit 1 ; }
  n="$1"

  echo ""
  BASH-2.05a$ df -k .
  Filesystem           1k-blocks      Used Available Use% Mounted on
  e:                     2096832    128832   1968000   7% /e
  BASH-2.05a$ mount
  c:\utils\cygwin\bin on /usr/bin type system (binmode)
  c:\utils\cygwin\lib on /usr/lib type system (binmode)
  c:\utils\cygwin on / type system (binmode)
  c: on /c type user (binmode,noumount)
  d: on /d type user (binmode,noumount)
  e: on /e type user (binmode,noumount)


% 
% What does it say if you do 'file meta-play.sh', ls -l of it?

Oh, right.

  BASH-2.05a$ ls -l ./meta-play.sh
  -rw-r--r--    1 david    unknown       907 Jun  4 19:30 ./meta-play.sh

So I tried adding a /bin/sh at the top but that didn't work:

  BASH-2.05a$ head -2 !$
  head -2 ./meta-play.sh
  #!/bin/sh
  [ -z "$1" ] && { echo "" ; echo "Whoa; gimma a disc ID like calix-01" ; echo "" ; exit 1 ; }
  BASH-2.05a$ !$
  ./meta-play.sh
  BASH: ./meta-play.sh: /bin/sh: bad interpreter: No such file or
  directory

So I changed it to bash and finally got somewhere:

  BASH-2.05a$ head -2 ./meta-play.sh
  #!/bin/bash
  [ -z "$1" ] && { echo "" ; echo "Whoa; gimma a disc ID like calix-01" ; echo "" ; exit 1 ; }
  BASH-2.05a$ ./meta-play.sh

  Whoa; gimma a disc ID like calix-01

Great; now we're moving!  Having paid attention over the past few days,
as I write this it occurs to me that perhaps playing with chmod will let
me hit ../m and <tab> when I'm in a CD dir...

Sure enough, a simple a+x does!  I still have to have the shebang line
in there, though, and so I have some other scripts to fix, but I'm on
the way.


Thanks so much, everyone!

HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) davidtg@justpickone.org * than to live up to them. -- fortune cookie
(work) davidtgwork@justpickone.org
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg00189/pgp00000.pgp
Description: PGP signature


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