bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: my bug report1: BASH command which says my shell script is not found


From: Bob Proulx
Subject: Re: my bug report1: BASH command which says my shell script is not found evenif it exists under $PATH, unless I add #!/bin/sh in the 1st line
Date: Sun, 8 Jul 2001 19:11:01 -0600

> 1st of all, I am very much delighted to use the GNU
> tools that I downloaded from www.cygnus.com.
> 
> Here is a bug report on BASH command 'which' and
> probably related 'chmod' and/or 'ls -ls' as well.

Thank you for your excellently prepared bug report.  It really stands
out as compared to most.  However on this bug list we are ill prepared
to deal with Cygwin difficulties as we are mostly focused on UNIX, and
sh-utils bugs in particular.  I don't think anyone over here even has
access to a Cygwin system.  Which leaves us hard pressed to answer
questions about it.

If you could make your report to the Cygwin group it would be most
appreciated.  I will include some information that might help from the
cygwin web page.

Thanks
Bob

Cygwin Home Page:
  http://sources.redhat.com/cygwin/

Cygwin Bug Report Guidelines:
  http://sources.redhat.com/cygwin/bugs.html


  Where should I send bug reports?

  First, you need to verify that your potential bug hasn't already
  been reported by reading the Cygwin FAQ and the mailing list
  archives. If your issue is still unresolved, feel free to write to
  the cygwin list with your problem.

  Please consider investigating it yourself and sending us patches if
  you figure out a solution. Bug reports without solutions are also
  welcome -- send a detailed description (with a test case if
  possible) to the Cygwin mailing list after reading our bug reporting
  guidelines. Due to the mailing list volume, we don't always reply to
  individual bug reports sent to the list but we do keep track of
  them.

  Bug reporting guidelines

       Use a subject line that describes the issue well: 

       Good examples: 
             "1.1.8: select bug (NT and 95)" 
             "1.1.6: problem building perl" 
             "1.1.8: question about catting binary files in bash" 

       Bad examples: 
             "bug" 
             "porting problem" 
             "help!!!!" 
             "bash question"
             "newbie needs help" 

       This also applies to general discussion. It's very hard to
       follow the list when most of the subject lines look very
       similar.

       In your description, show how to reproduce the problem. This
       means including a test case if at all possible.

       At the very least, always include which cygwin beta release you
       are using and give the operating system and its version
       number. E.g.  "cygwin v1.1.9 under NT 4.0".

       Run cygcheck -s -v -r > cygcheck.out and include that in your
       report.

       Keep in mind that there are over 1500 people on the mailing
       list. Try to avoid "me too" responses or reporting problems
       that have already been reported. It's hard enough keeping up
       with the volume as it is...

       Include a patch to fix the problem if you can. Please see how
       to contribute for more information.

> Hi,
> 
> 1st of all, I am very much delighted to use the GNU
> tools that I downloaded from www.cygnus.com.
> 
> Here is a bug report on BASH command 'which' and
> probably related 'chmod' and/or 'ls -ls' as well.
> 
> A. summary of my bug report1:
> ----------------------------
> 
> BASH command which says my shell script is not found
> evenif it exists under $PATH, unless I add #!/bin/sh
> in the 1st line
> 
> B. Details:
> -----------
> 
> If I write my own shell scripts and store under my own
> directories and add that directory name into my $PATH
> and chmod it to executable to mode, it gets executed
> alright, but it is not recognized by 'which' command,
> and also it is not indicated as an executable with x
> flag in rwx in ls -ls output.
> 
> The work around is to make sure that, we always add
> the #!/bin/sh as the 1st line in that user script.
> 
> C. How to reproduce the problem?
> --------------------------------
> 
> 1. Run the following commands
> 
> $ mkdir $HOME/bin
> $ export PATH="$PATH:$HOME/bin"
> 
> 2. Create my following script vii under your $HOME/bin
> What it does is...
> 
> - it accepts a command line argument as input string,
> which is supposed to be some executable file -- some
> shell script
> 
> - it runs 'which' on that string and if it is found
> under $PATH, then it opens a vi-session to edit that
> script.
> 
> This way, user need not remeber where are all those
> shell scripts, he wrote and stored under what
> directories.
> 
> $ cd $HOME/bin
> $ cat vii
> cmd=$1
> fullpath=$(which $cmd 2>/dev/null)
> pathknt=$(echo $fullpath | wc -w)
> if [ $pathknt -eq 1 ]
> then
>         echo OK, $cmd is found in $fullpath. Enter
> return to view.
>         read x
>         vi $fullpath
> else
>         echo Sorry, $cmd is not found in your $PATH
> fi
> 
> $ chmod a+x vii
> 
> 3. Try a direct whcih command on it and it fails:
> $ which vii
> no vii in
> /usr/local/bin:/usr/bin:/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem:/home/Administrator/bin
> 
> 4. Even the ls -ls does not say that that x bit is set
> for allowing execution mode.
> $ ls -ls
> total 2
>    1 -rw-r--r--    1 Administ None          250 Jun 29
> 12:18 vii
> $
> 
> 4. Now execute my shell script vii
> $ vii vii
> Sorry, vii is not found in your
> /usr/local/bin:/usr/bin:/bin:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem:/home/Administrator/bin
> 
> D. Workaround:
> 
> 5. Now add #!/bin/sh as the 1st line in the above
> script and everything wotrks as  expected.
> 
> $ which vii
> /home/Administrator/bin/vii
> address@hidden /cygdrive/z/Public/tools/bin
> $ cd $HOME/bin
> $ ls -ls
> total 2
>    1 -rwxr-xr-x    1 Administ None          248 Jun 29
> 12:13 vii
> $
> 
> If you have a solution, or planning to fix it in next
> release, please let me know.
> I can volunteer to fix it as well and proide a fix.
> Please let me know how to signup.
> 
> Thanks,
> Satya Nemana
> 
> Home Phone: 732-264-5756
> EMail: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]