converting from shell script to python

Mathias Waack mathias-usenet at valpo.de
Tue Apr 1 08:42:29 CEST 2003


Shao Zhang <shao at cia.com.au> wrote:

> #!/bin/sh
> ROOTDIR=/usr/lib
> CLASSPATH="$ROOTDIR/a/a.jar:$ROOTDIR/b/b.jar:$ROOTDIR/c/c.jar"
> java -classpath $CLASSPATH foo

How about: 

import os

ROOTDIR='/usr/lib'
CLASSPATH="%s/a/a.jar:%s/b/b.jar:%s/c/c.jar" % \
          (ROOTDIR,ROOTDIR,ROOTDIR)
os.system('java -classpath %s foo' % (CLASSPATH))

Sorry that it comes without lists/array/join etc;)

Mathias




More information about the Python-list mailing list