[Techtalk] filtering command line

Miriam English mim at miriam-english.org
Mon Jun 11 11:42:03 UTC 2007


Hi folks,

I need to send a file name along with its path to a program running 
under Wine on Linux. Originally I used a little script:

#! /bin/sh

if [$1 = ""]; then
	wine c:\\textpad\\TextPad.exe
else
	wine c:\\textpad\\TextPad.exe "z:$@"
fi

Which worked fine for TextPad (a brilliantly flexible programmers text 
editor), but fails for irfanview (a superb, small, fast picture 
viewer/converter). At first I was stumped as to why this would be so, 
but then I began to suspect it was because TextPad was able to cope with 
"/" characters in the path, but irfanview required "\".

Does anybody know a very simple filter to substitute "\" for "/" in the 
passed file path?

After doing a fair bit of reading I have a feeling I might need to use 
sed with something like
s/\//\\/g
Trouble is I've never used sed before and I have no idea how I'd use it 
in a shell script to get the input, and then to pass the filtered result 
to the wine line.

Anybody know how? Or anybody know a better way?
Surely there is a simple command that does pattern replacement on a 
command line.

Best wishes,

	- Miriam

-- 
---------=---------=---------=---------=---------=---------=------
A life! Cool! Where can I download one of those from?
---------=---------=---------=---------=---------=---------=------
Website: http://miriam-english.org
Blog: http://miriam-e.livejournal.com


More information about the Techtalk mailing list