bug-bash
[Top][All Lists]
Advanced

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

Re: Encoding oddity


From: Dennis Williamson
Subject: Re: Encoding oddity
Date: Fri, 10 Dec 2010 04:56:37 -0600

On Fri, Dec 10, 2010 at 2:04 AM, Richard <address@hidden> wrote:
> Hi!
>
> On 10. des. 2010, at 06.26, Dennis Williamson wrote:
>
>>> ------------------------------------------
>>> #!/bin/bash
>>>
>>> touch /Users/myuser/pretérito.txt
>>>
>>> # Example 1
>>> myfile="/Users/myuser/pretérito.txt"
>>>
>>> for b in "$myfile"; do
>>>        if [[ $b == $myfile ]]; then
>>>                echo "OK 1: $b ------ $myfile"
>>>        fi
>>> done
>>>
>>> # Example 2
>>> myfolder="/Users/myuser/"
>>> unset b
>>> for b in "$myfolder"*; do
>>>        if [[ $b == $myfile ]]; then
>>>                echo "OK 2: $b ------ $myfile"
>>>        fi
>>> done
>>> -----------------------------------------
>>>
>>> Richard Taubo
>>>
>>
>>        if [[ $b == $myfolder$myfile ]]; then
>>
>> Try
>>
>> echo $myfolder/*
>>
>> you will see that each file has the directory name prepended.
>
>
> Thanks for feedback!
>
> Do you mean:
>
> ------------------------------------------
> #!/bin/bash
>
> touch /Users/myuser/pretérito.txt
> myfile="pretérito.txt"
>
> myfolder="/Users/myuser/"
> for b in "$myfolder"*; do
>      if [[ $b == $myfolder$myfile ]]; then
>               echo $myfolder/*
>       fi
> done
> -----------------------------------------
>
> That gives the same result as before, i.e. it does not work.
>
> Thanks!
>
> Richard Taubo

No, I meant to use the echo separately so you could see what the glob was doing.

I'm sorry, because of the way I tested it, I made a mistake in what I
posted. The line should be as you originally had it. It should work.

It sounds like there's a problem with your locale. What does the
locale command output?



reply via email to

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