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

Re: bash read oddity



29.12.2002 05:06:21, "Jamin W. Collins" <jcollins@asgardsrealm.net> wrote:

>Got a strange situation happening on a friends Debian box.  I found the
>problem by debugging his ALSA startup problems.  Turns out that he's
>getting some extra character added to the output of "read" command.
>
>The following commands replicate this:
>   $ set -x
>   $ awk '/^((alias)|(probe)) +snd-card-[0-9]/ {print $3}' \
>      /etc/modules.conf | ( while read -e line; do echo $line; done; )
>
>on my friend's system this results in:
>
>   + awk '/^((alias)|(probe)) +snd-card-[0-9]/ {print $3}' /etc/modules.conf
>   + read line
>   + echo $'snd-emu10k1\r'

seems like he has CR (Carriage Return) appended to his lines in /etc/modules.conf
You can check with
  cat -A /etc/modules.conf
where the CR appear as ^M

>   snd-emu10k1
>   + read line

I have no idea, why the -e would be missing here

>
>on my system this results in:
>
>   + awk '/^((alias)|(probe)) +snd-card-[0-9]/ {print $3}' /etc/modules.conf
>   + read -e line
>   + echo snd-ymfpci
>   snd-ymfpci
>   + read -e line

This resembles the output I get.

>
>Both systems are running the same versions of bash and libc6.  Any
>ideas?

HTH, Michael






Reply to: