Shell, not successful

Source: Internet
Author: User

###### #时钟
#!/bin/bash
Min=1
Hour=1
for ((sec=5; sec>=0; sec--))
Do
Echo-ne "${hour}:${min}:${sec}s End"
Sleep 1
Echo-ne "\ r \ r"

While ["$SEC"-le "0"-a "$MIN"-ge "0"]
Do
Echo-ne "${hour}:${min}:${sec}s End"
Echo-ne "\ r \ r"
((min--))
Sec=60
While ["$MIN"-lt "0"-a "$HOUR"-GT "0"]
Do

Echo-ne "${hour}:${min}:${sec}s End"
Echo-ne "\ r \ r"
((hour--))
min=59
Done
Done
While ["$SEC" = "0"-a "$MIN" = "0"-a "$HOUR" = "0"]
Do
echo "Time is up!! ........."
Break
Done
Done

[Email protected] shell]# sh clock1.sh
1:0:48s after the end of ^c

2. Test whether the host is turned on and set up the user

[[email protected] mnt]# vim ssh.exp
#!/usr/bin/expect
Set timeout 3
Set IP [lindex $argv 0]
Set PASS [lindex $argv 1]
Set COMM [lindex $argv 2]
spawn ssh [email protected] $IP $COMM
Expect {
 &nbs p;      "yes/no"
        {send "yes/r"; exp_ Continue}
        "password:"
         {send "$PASS \ r"}
       }
expect EOF
spawn/root/desktop/shell/ ask.sh
        Expect "name:"
         Send "liu\r"
        expect "old"
         send "17\r"
        Expect "class"
         send "8\r"
expect EOF

#!/bin/bash
For NUM in {15..20}
Do
Ping-c1-w1 172.25.254. $NUM &>/dev/null && (
/mnt/ssh.exp 172.25.254. $NUM redhat hostname | Grep-e "the| Ecdsa|connecting| Warning|password|spawn "-v|sed" s/permission\ denied\,\ please\ try\ again\./172.25.254. $NUM password is error/g "
)
Done
???

Shell, not successful

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.