cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
752
Views
0
Helpful
0
Replies

Certain SSH shell script doesn't run well in Cisco APIC bash

fc00::/7
Level 1
Level 1

The following ping script is running just fine in both script form and interactive shell

ping-only.sh

date
for i in 10.1.1.1 10.1.1.3 10.4.1.13
do echo -e "\**bleep**: $i"
ping -c 1 $i | grep from
done

However, when I run the SSH shell script, it just stuck at the first host

ssh-get-banner-only.sh

date
for i in 10.1.1.1 10.1.1.3 10.4.1.13
do echo -e "\**bleep**: $i"
timeout 1 ssh $i
done

Sample output

user@APIC> ./ssh-get-banner-only.sh
Mon May 6 04:43:24 UTC 2019

IP: 10.1.1.1
###############################################################
# Authorized access only! #
###############################################################

It work just fine when I paste the same code manually to the shell

user@APIC> date
Mon May 6 04:36:33 UTC 2019
user@APIC> for i in 10.1.1.1 10.1.1.3 10.4.1.13
> do echo -e "\**bleep**: $i"
> timeout 1 ssh $i
> done


IP: 10.1.1.1
###############################################################
# Authorized access only! #
###############################################################

Password:

IP: 10.1.1.3
###############################################################
# Authorized access only! #
###############################################################

Password:

IP: 10.4.1.13
###############################################################
# Authorized access only! #
###############################################################

Password:
user@APIC>
0 Replies 0

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License