Dear Member,
OLD Question --> disable-completion not solved
My bash Menu script ping process problem.
If ping still running and users press [Tab Key] SCREEN is Blank...
Cant Members help me.. kill signal [Tab Key] or others scripting for my case, btw i use Linux..
Thanks,
Rico
My Bash Script :
#!/bin/bash
declare -r DIALOG_OPTS="0 0 0"
declare -i -r OUTPUT_DIALOG_WIDTH=60
pipe_command_to_tailbox_dialog() {
local -i height=5+$1; shift
local title="$1"; shift
local command="$1"; shift
local output_file=`mktemp`
(eval $command) >& $output_file &
local -i bg_job=$!
dialog --title "$title" --tailbox $output_file $height $OUTPUT_DIALOG_WIDTH
if [ -d /proc/$bg_job ]; then
kill $bg_job || kill -9 $bg_job >& /dev/null
fi
wait $bg_job
rm -f $output_file
}
# pings a host with a nice dialog
ping_host_dialog() {
local ping_params_tmp=`mktemp`
if dialog --ok-label "Submit" \
--form "Ping host" \
$DIALOG_OPTS \
"Address:" 1 1 "192.168.1.1" 1 30 40 0 2> $ping_params_tmp; then
local address=`head -1 $ping_params_tmp | tail -1`
fi
rm -f $ping_params_tmp
if [ x"$address" != x ]; then
pipe_command_to_tailbox_dialog 15 "Pinging host \"$address\"" "ping \"$address\""
fi
}
main() {
ping_host_dialog;
}
main "$@"