help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] checking file line: 'commit;'


From: Paolo Supino
Subject: Re: [Help-bash] checking file line: 'commit;'
Date: Thu, 11 Aug 2016 16:55:33 +0200

Hello Greg

You're right... The file were originally written in Windows and there's
Windows garbage (carriage return) follows 'commit;' string :-( Changing the
check to 'commit;'$'\r'  fixes the problem...
I wish I could sanitize the file or work on sanitized version, but the
project manager isn't willing to take the risk :-(


Thanks
Paolo



On Thu, Aug 11, 2016 at 4:45 PM, Greg Wooledge <address@hidden> wrote:

> On Thu, Aug 11, 2016 at 04:34:28PM +0200, Paolo Supino wrote:
> > Hi Chet
> >
> > thank you for the reply, I tried [ "$string" = 'commit;' ] but it didn't
> > work :-( and I don't think that case cuts it for my problem.
>
> You probably have whitespace or other garbage in your string.
> Find out what's in it, either by running that section of the script
> with 'set -x' enabled, or by doing "declare -p string" before the
> check, or by doing something like printf %s "$string" | hexdump.
>
> If the string is coming from a file that has ever been touched by a
> Windows machine, then carriage return is a very probable candidate for
> your unwanted garbage character.
>


reply via email to

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