diff scripts/run_project.sh @ 60:ad6b2767beaf newapi

Command-line argument support for BeagleRT program in scripts, plus a simple script for halting the BBB
author andrewm
date Wed, 15 Jul 2015 18:53:10 +0100
parents 3ffafa57302c
children afc593f7469e
line wrap: on
line diff
--- a/scripts/run_project.sh	Wed Jul 15 17:50:09 2015 +0100
+++ b/scripts/run_project.sh	Wed Jul 15 18:53:10 2015 +0100
@@ -5,24 +5,28 @@
 
 BBB_ADDRESS="root@192.168.7.2"
 BBB_PATH="~/BeagleRT"
+COMMAND_ARGS=
 
 function usage
 {
     THIS_SCRIPT=`basename "$0"`
-    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone]"
+    echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone] [-c command-line-args]"
 
     echo "
     This script runs a previously compiled BeagleRT project on the 
     BeagleBone Black. The -b option changes the default path, which
-    is otherwise $BBB_PATH."
+    is otherwise $BBB_PATH. The -c option passes command-line arguments
+    to the BeagleRT program; enclose the argument string in quotes."
 }
 
 OPTIND=1
 
-while getopts "b:h" opt; do
+while getopts "b:c:h" opt; do
     case $opt in
         b)            BBB_PATH=$OPTARG
                       ;;
+        c)            COMMAND_ARGS=$OPTARG
+                      ;;
         h|\?)         usage
                       exit 1
     esac
@@ -31,4 +35,4 @@
 shift $((OPTIND-1))
 
 echo "Running BeagleRT..."
-ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; screen -d -m $BBB_PATH/BeagleRT"
\ No newline at end of file
+ssh $BBB_ADDRESS "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; sleep 0.5 ; screen -d -m $BBB_PATH/BeagleRT $COMMAND_ARGS"
\ No newline at end of file