| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:date:message-id:subject:from:to | |
| :content-type; q=dns; s=default; b=wvk/N60Oe+bIWA+8kQjyOwoXHUcEb | |
| NP1edt3zkiNzo06HdsjI5hGxK33++i6hzKEcs+nZDuzroTvpZRfxWpL0XLkAwDlj | |
| okBLazDqLTnjMZEiAvABFKTyMzkij1JWxbS1Np0sZbIJbOGikHVRWHkzilzHhgeR | |
| cHIBYqGl6xY72c= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:date:message-id:subject:from:to | |
| :content-type; s=default; bh=2BeGyyQQmVqExU0tL18SGL+MS6o=; b=sGl | |
| mnDL8YZfpcCv4msCPSWKK/VJC9ha8uKMHKAYBvYIA8ujFhfknhAb7wxFVoxqxuL1 | |
| JKVsGp+rOEVplQE/ouxaw/WZyqedt9AZwOGfN+nhU456MX1/7lrDVMcS1AF4OuS0 | |
| 3RvqhvJlNa70fFgq+nbo3I1YkPJwY8dQQGuRV1B8= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
| X-HELO: | mail-oi0-f44.google.com |
| MIME-Version: | 1.0 |
| X-Received: | by 10.182.19.195 with SMTP id h3mr9829253obe.43.1411141850429; Fri, 19 Sep 2014 08:50:50 -0700 (PDT) |
| Date: | Fri, 19 Sep 2014 17:50:50 +0200 |
| Message-ID: | <CA+rGx5fDntZ-7ge-ucPvygPJ6tAC93DFvHd1UbM6=AUVjxJW7w@mail.gmail.com> |
| Subject: | ctrl-c not working |
| From: | Thomas Schweikle <tschweikle AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
Having following scripts:
bin/tc:
--- <snip>
#!/usr/bin/bash
host=""
loop=0
conf=default
port=22
user=$USERNAME
cssh=1
cping=1
recon=0
while [ -n "$1" ]; do
case "$1" in
-f) conf="$2"; shift ;;
-h) host="$2"; shift ;;
-l) loop=1 ;;
-nping) cping=0 ;;
-nssh) cssh=0 ;;
-p) port="$2"; shift ;;
-u) user="$2"; shift ;;
*) echo "$0: Error: Unknown option: \"$1\"!" ;;
esac
shift
done
if [ -e $conf ]; then
conf="$PWD/$conf"
elif [ -e $HOME/.mintty/$conf ]; then
conf="$HOME/.mintty/$conf"
else
echo "$0: Error: Unknown config-file: \"$conf\" - not found in
\"$PWD\"; \"$HOME/.mintty\"!"
fi
mintty -s 132,43 -t "${user}@${host}" \
-c "${conf}" \
-e _ssh "$user" "$host" "$port" "$conf" "$loop" "$cssh" "$cping" &
--- <snap>
and bin/_ssh:
--- <snip>
#!/usr/bin/bash
user=$1
host=$2
port=$3
conf=$4
loop=$5
cssh=$6
cping=$7
while :; do
printf '\x2d %s ssh connect ' ${host}
if [ "$host" == "localhost" ]; then
exec /usr/bin/bash -l
else
while :; do
if [ $cping -ne 0 ]; then
if ( ! ping -n 1 ${host} > /dev/null 2>&1 ); then
printf '.'
sleep 1
continue
fi
fi
if [ $cssh -ne 0 ]; then
if ( ! nc -z ${host} ${port} > /dev/null 2>&1 ); then
printf '/'
sleep 1
continue
fi
fi
break
done
printf '\n'
/usr/bin/ssh \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no -X -K \
-p ${port} \
-l ${user} ${host}
[[ $loop -eq 0 ]] && break
printf 'Reconnecting ...'; sleep 3
printf '\n'
fi
done
--- <snap>
started by:
C:\cygwin\bin\bash.exe -l -c "tc -f tpstest -l -u root -h fbsd12-64"
does what it is expected to do: starting mintty, then checking
reachability of the given host. If the host is reachable ssh is
started and connects to the host. If the host is gonig down
intentionally or not, it tries again to reach the host and if it is
reachable connects again to it.
Now if I type ctrl-c while trying to connect nothing happens. But I'd
like the script to bail out, terminating. But nothing works: ctrl-c
doesn't ctrl-z doesn't. I only can kill -9 the bash associated with
it.
How do I get ctrl-c to work?
--
Thomas
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |