Skip to content
Snippets Groups Projects

Batch setpid

Merged bbartels requested to merge batch-setpid into master
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
+ 17
0
#!/bin/bash
# Use default filename if it wasn't given at the command line
if [ $# -eq 0 ]; then
filename="scripts/parameters.txt"
else
filename=$1
fi
# Define the regular expression used for grep to define accepted line
regex='(lat|long|height|pitch|roll|yaw|pitchv|rollv|yawv) (p|i|d) ([-+]?[0-9]*\.?[0-9]+)'
# the awk program to assemble the correct pieces of the string for a ./Cli call
awk_prog='{print "./Cli setpid" " " "--" $1 " " "-" $2 " " $3}'
# Search, parse, and execute ./Cli commands
grep -E "$regex" $filename | awk "$awk_prog" | bash
\ No newline at end of file
Loading