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]

RE: Change in behavior of bash / if [


To close the loop:

I thought that before hitting "Send" with my response to Eric's latest
email, I should check to see if the problem was still happening.  I
removed the quotes from around x$1 and ran it.  The scripts now works
as expected.  So whatever it was, it was temporary and can no longer be
reproduced.  Sigh.

Eric, thanks for all the time you put into addressing this issue.

Best wishes,

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

----

The following is for the archive in case this comes up again.  (Really
because I wrote it before I thought to test to see if the behavior had
fixed itself.)  I don't expect anyone to read it or do anything.

Eric Blake sent the following at Wednesday, December 18, 2013 10:28 AM
>On 12/18/2013 07:18 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>>>> if [ "x$1" = xclip ]
>>>
>>> Yes, this is the correct fix for the improper quotation of the earlier
>>> example.
>>
>> But why would it need quoting unless the first argument unless the
>> command line is quoted and might have a space"?  It wasn't.  It was
>> called from a script that was being sourced by a bash interactive shell
>> as follows.
>>
>> lddir clip
>
>I'd need to see your entire script to know for sure. Perhaps you are
>using calls to 'set' or using shell functions, either of which modifies
>$1 from the value that you passed on the command line. But the point
>remains - your improper quoting of $1 is not a cygwin-specific issue.
>> Speculation:  Since cygwin1.dll was updated last week, perhaps
>> something happened there.
>
>Less likely. But without seeing your entire script, it's hard to say.
>You haven't given anyone else enough to go on.

Here are the scripts without the quotes.  Both are kept in /BW, which
is NOT in the path.

ldc is accessed as an alias, set in ~/.bashrc.

/BW> alias ldc
alias ldc='. /BW/ldc'

Background:

lddir was written first.  It was used to load Windows Explorer in a
particular directory that was based on a string provided as an argument.
(lddir was written to avoid a lot of effort navigating a directory tree
in Explorer.)

ldc was written second.  It takes a string from the Windows clipboard,
finds a substring of the format that lddir is looking for, gets a posix
path from lddir based on the substring, changes to the directory of that
path, feeds the windows version of that path to the clipboard, and does
a bunch of other stuff.  (ldc was designed so I could easily get a
string from an email and generate a path so I could easily get to the
folder where I needed to save it's attachments.  Additionally, it move
my shell to that directory so I can use cygwin tools on it.  Originally
it just did the clipboard -> path -> clipboard + cd and with time the
"bunch of other stuff" was added.  I should probably combine them.)

Anyway, thanks for taking interest in this.  As I said, I added the
quotes and it works so I don't really need this fixed.

Best wishes,

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

Attachment: ldc
Description: ldc

Attachment: lddir
Description: lddir

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