-
Notifications
You must be signed in to change notification settings - Fork 2
Awb shell tips and tricks
Following are some examples of the use of awb-shell.
There are a couple of tricks that make it easier to use the awb-shell command-line interface in interactive mode. Following are a few such techniques.
As with the bash(1) shell and other programs, a very useful technique in awb-shell is tab completion. If you type the beginning letters of a command and then press the key, awb-shell will attempt to complete the the command for you, or list the possible commands that begin with the letters you have typed. For example, type ‘co’ and then press the key on your keyboard and you see the actions that begin with ‘co’:
% awb-shell awb> co<tab> commit configure awb> co
Now press the n key, and press again. Now awb-shell completes the first word of the command for you and adds a space to begin the next word of the command.
awb> configure
Awb-shell commands tend to be in the following form:
<verb> <type of object> <specific object> [--<switch>]...
So after typing ‘configure’ another will show the types of object that can be ‘configured’.
awb> configure <tab> model package
Tab completion works for the as well. So for a ‘checkout package’ command the list of available packages will be listed.
awb> checkout package a<tab> airblue/ asimcore/ awb/ awb>
Frequently the will be a file name. In such cases, if you type a directory in the package’s uniondir then completion will follow the uniondir structure:
awb> configure model config/pm/ config/pm/leap config/pm/mit-6.s078 awb> configure model config/pm
Finally after specifying the specific object to operate on, typing ‘—’ will show you the switches that can be added to an awb-shell command.
awb> update package all --<tab> --build --nobuild --rehash --norehash awb> update package all --
Running in an interactive session can be convenient since some default values like the name of the .apm file and benchmark configuration file are remembered across steps. Thus once a model has been specified the .apm file for that model is remembered for subsequent commands that operate on a model. Similarly, once a benchmark .cfg file has been specified it is also remembered for subsequent commands that take a benchmark.
% awb-shell awb> set model config/pm/leap/demos/hello/hello_hybrid_exe.apm awb> set benchmark config/bm/leap/demos.cfx/benchmarks/null.cfg .... awb> configure model .... awb> build model ..... awb> setup benchmark ..... awb> run benchmark ..... awb> quit
Another handy feature of awb-shell is that you can cycle through your previous commands. Awb-shell stores a history of the commands you have typed in the current session and you can press the up arrow key to cycle through the history. Incremental search of the previous commands can be invoke with ctrl-R. The latest versions of awb-shell save your command history across invocations of awb-shell.
Occasionally you might want to type a shell command in the midst of your awb-shell session. If you type an exclamation mark at the awb-shell command prompt then the words after the exclamation mark will be treated as a shell command. If you want to execute that command in a particular directory you can change directory (cd) to various locations before invoking such commands.
awb> cd package leap awb> ! pwd
If you don’t like entering a interactive shell then awb-commands can be entered directly to the unix shell.
Commands to awb-shell can be entered on the command line after the awb-shell command, but all models and benchmarks need to be specified explicitly:
% awb-shell -- configure model config/pm/leap/demos/hello/hello_hybrid_exe.apm % awb-shell -- build model config/pm/leap/demos/hello/hello_hybrid_exe.apm % awb-shell -- setup benchmark config/bm/leap/demos.cfx/benchmarks/null.cfg --model config/pm/leap/demos/hello/hello_hybrid_exe.apm % awb-shell -- run benchmark config/bm/leap/demos.cfx/benchmarks/null.cfg --model config/pm/leap/demos/hello/hello_hybrid_exe.apm
Note the ‘—’ before the commmand that is required if the command takes a switch itself. Switches to awb-shell can be entered before that ‘—’. One such switch that can be useful in this scenario is ‘—batch’ which tells awb-shell to not ask for any input interactively.
Don’t like re-typing the same set of commands over and over. Awb-shell allows one to run a sequence of command from a file. So if one creates a file named run-hello.aws containing the following:
set model config/pm/leap/demos/hello/hello_hybrid_exe.apm set benchmark config/bm/leap/demos.cfx/benchmarks/null.cfg configure model build model setup benchmark run benchmark
Then you can run that sequence of commands with the following:
% awb-shell --file run-hello.aws
A file name of ‘-’ will read commands from STDIN.
cat run-hello.aws | awb-shell —file -
This can be useful when building bash scripts with awb-shell, e.g.,
#!/bin/bash # awb-shell --file - <<EOF set model $1 set benchmark $2 configure model build model setup benchmark run benchmark EOF