-
Notifications
You must be signed in to change notification settings - Fork 4
Scripting
#!/usr/bin/as3shebang
import shell.*;
trace( "hello world" );
trace( "args:" + Program.argv );
usage:
$ ./myscript
and $ ./myscript one two 1 2
This is the "default" as it is where we install the as3shebang
executable by default.
#!/usr/bin/env as3shebang
import shell.*;
trace( "hello world" );
trace( "args:" + Program.argv );
usage:
$ ./myscript
and $ ./myscript one two 1 2
This is a bit "better" and in some case "more portable".
By using /usr/bin/env
it will returns any as3shebang
found in the current user path,
some consider this better as it avoid to hardcode the path to the as3shebang
executable
and so allow to run multiple versions in parallel.
But for the very same reasons it could be considered "not better", your experience may vary.
#!/opt/local/bin/as3shebang
import shell.*;
trace( "hello world" );
trace( "args:" + Program.argv );
usage:
$ ./myscript
and $ ./myscript one two 1 2
You can point directly to an as3shebang
executable custom path.
#!
':' //; exec "$(which as3shebang)" "$0" "$@"
import shell.*;
trace( "hello world" );
trace( "args:" + Program.argv );
usage:
$ ./myscript
and $ ./myscript one two 1 2
It's more a trick than anything else but it will work.
':' //; exec "$(which redshell_dd)" "$0" "$@"
import shell.*;
trace( "hello world" );
trace( "args:" + Program.argv );
usage:
$ ./myscript
and $ ./myscript one two 1 2
This will work too but then it will not really be considered a shell script
as it is run through the redshell_dd
executable instead of the as3shebang
executable.