[Techtalk] filtering command line

Wim De Smet kromagg at gmail.com
Mon Jun 11 17:03:04 UTC 2007


On 6/11/07, Miriam English <mim at miriam-english.org> wrote:
> Feedback for anybody attempting something similar...
>
> I made this simple script:
>
> #! /bin/sh
>
> if [ $1 = "" ]; then
>         wine c:\\irfanview\\i_view32.exe
> else
>         echo "z:$@" | tr '/' '\\' > /tmp/iview_start
>         export iview_start=`cat /tmp/iview_start`
>         wine c:\\irfanview\\i_view32.exe "$iview_start"
> fi
>
>[...]
> If I have done this an unnecessarily complicated way and there is a much
> better way please let me know. I'd be rapt to learn more.

You seem to know about backquotes so I'm not sure why you use that
intermediate step of writing it to a temporary file? You could just
make one line out of it:
wine c:\\irfanview\\i_view32.exe `echo "z:$@" | tr '/' '\\' `

greets,
Wim


More information about the Techtalk mailing list