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

Re: scripting problem



On Sat, 26 Nov 2005 15:31:24 -0500
Michael Marsh <michael.a.marsh@gmail.com> wrote:

> On 11/26/05, Jan de Haan <j.de.haan@home.nl> wrote:
> > David Koski <david@kosmosisland.com> wrote:
> > > > echo -n "3 ===";echo -n ${MD5PW} | tr ' ' '\n' | while read char ; do awk \
> > > > '{printf("%c",$char)}' ; done ; echo "===" user@testbox:/home/user/tmp
> > >
> > > Try to replace "awk" with "echo $char | awk".
> > > I know that doesn't answer your question.
> >
> >         thanks for your answer.
> >         I loose the last character now ;-)
> 
> Have you tried removing the "-n" from "echo"?  I'd guess that read is
> waiting for the last carriage return, which you've inhibited.
> 
> --
> Michael A. Marsh
> http://www.umiacs.umd.edu/~mmarsh
> http://mamarsh.blogspot.com
> 

Thanks guys!


user@testbox:/home/user/tmp >cat t5.sh
#!/bin/sh

export INPUT='$1$iW95z/HB$GFcYFxMKK6x8EUPglVkux.'

echo "1 ==="$INPUT"==="

export MD5PW=$(echo -n "$INPUT" |  hexdump -v -e '" " 1/1 "%02d"')

echo "2 ==="${MD5PW}"==="

echo -n "3 ===";echo -n ${MD5PW} | tr ' ' '\n' | while read char ; do echo $char | awk '{printf("%c",$1)}' ; done ; echo "==="
user@testbox:/home/user/tmp >./t5.sh
1 ===$1$iW95z/HB$GFcYFxMKK6x8EUPglVkux.===
2 === 36 49 36 105 87 57 53 122 47 72 66 36 71 70 99 89 70 120 77 75 75 54 120 56 69 85 80 103 108 86 107 117 120 46===
3 ===$1$iW95z/HB$GFcYFxMKK6x8EUPglVkux===



Reply to: