Discussion:
making a script aware of the system it is running on
(too old to reply)
nukeymusic
2011-11-26 15:55:32 UTC
Permalink
I sometimes run scripts on a linux-machine for which I have files
printed like this
print -deps ~/work/myfigure.eps
However when I run the same script from windows I need something like
print -deps g:\work\myfigure.eps

What I want to do is make my script decide itself which system it is
running on and then using the appropriate syntax.
Does anyone here know here how to do that?

regards,
nukey
PiLS
2012-01-07 01:19:18 UTC
Permalink
Post by nukeymusic
I sometimes run scripts on a linux-machine for which I have files
printed like this
print -deps ~/work/myfigure.eps
However when I run the same script from windows I need something like
print -deps g:\work\myfigure.eps
What I want to do is make my script decide itself which system it is
running on and then using the appropriate syntax.
Does anyone here know here how to do that?
regards,
nukey
Just noticed your post; I do know how to do that, I use it regularly
to write system-agnostic code; just not with me right now.
The first step is to determine the system we're running on (one line)
Then for a one-time switch you can hardwire the paths; otherwise there
is a separator variable that can be set.
I could try and give you an approximate answer now, or I could wait
until Monday and give you a tried-and-tested copy-paste.
I think I will wait until Monday. Stay tuned.
That's trivial, BTW, so I suspect you might have found a solution
floating around on the web by now.
--
PiLS
Continue reading on narkive:
Loading...