-
Notifications
You must be signed in to change notification settings - Fork 347
Shebang
dtmilano edited this page Apr 29, 2013
·
4 revisions
Shebang extends the standard shebang line functionality found on Linux, Mac OSX and Windows Cygwin allowing for use cases that would be otherwise impossible.
See the details at https://github.com/dtmilano/shebang
shebang can be used to simplify script creation and the way scripts locate AndroidViewClient modules.
A typical shebang for a script would be:
#! /usr/local/bin/shebang monkeyrunner -plugin $AVC_HOME/bin/androidviewclient-$AVC_VERSION.jar @!
This shebang line uses:
- Absolute path of
shebang
to enable the use of shebang line extensions -
monkeyrunner
set as the interpreter for the script -
$AVC_HOME
environment variable to locate AndroidViewClient installation (AVC_HOME
is used instead ofANDRODI_VIEW_CLIENT_HOME
to reduce the shebang command line length and prevent reaching Linux maximum length which isBINPRM_BUF_SIZE = 128
) -
$AVC_VERSION
to specify the jar version to be used (AVC_VERSION
is used instead ofANDRODI_VIEW_CLIENT_VERSION
to reduce the shebang command line length and prevent reaching Linux maximum length which isBINPRM_BUF_SIZE = 128
) -
@!
to mark the end of shebang arguments
A typical shebang for a script would be:
#! /usr/bin/env shebang monkeyrunner -plugin $ANDROID_VIEW_CLIENT_HOME/bin/androidviewclient-$ANDROID_VIEW_CLIENT_VERSION.jar @!
This shebang line uses:
- /usr/bin/env to look for
shebang
executable inPATH
-
shebang
to enable the use of shebang line extensions -
monkeyrunner
set as the interpreter for the script -
$ANDROID_VIEW_CLIENT_HOME
environment variable to locate AndroidViewClient installation -
$ANDROID_VIEW_CLIENT_VERSION
to specify the jar version to be used -
@!
to mark the end of shebang arguments
Using previous shebang command line permits to further simplify the imports as showed by this snippet:
#! /usr/bin/env shebang monkeyrunner -plugin $ANDROID_VIEW_CLIENT_HOME/bin/androidviewclient-$ANDROID_VIEW_CLIENT_VERSION.jar @!
from com.dtmilano.android.viewclient import ViewClient
...