#!/bin/bash # copyright (c) 2012, P. Lutus # released under the GPL hamlib_port=4532 # define rigctld network call nccom="nc localhost $hamlib_port" HISTFILE="$HOME/.hamlibhistory" # read past Hamlib command history history -r if [ -z $1 ]; then read -ep "enter launch arguments for rigctld: " params history -s '' "$params" else params="$@" fi # exit function function quitfunc { # save history history -w echo "Quitting ..." echo "\set_powerstat 0" | $nccom sleep 0.25 kill $proc exit } # launch hamlib daemon with supplied parameters rigctld $params & # get daemon process number proc=$! # exit gracefully trap 'quitfunc' EXIT # accept typed commands while true; do # history-enabled readline read -ep "Enter rigctld command (q = quit): " line # quit if user wants [ "$line" == 'q' ] && break history -s '' "$line" echo "$line" | $nccom done