"Linux-shell" shell script basic grammar Exercises

Source: Internet
Author: User

has been learning, but also has been forgotten, today with the help of this blog post, to record their own learning process some of the most basic things!


1. For

#!/bin/bashfor i in {1..10}do echo $idone

Scan the active IP in the target network segment

#!/bin/bashfor IP in 192.168.1. {1..255};d oping $ip-C 2 &>/dev/null, if [$?-eq 0];thenecho $ip is alivefidone

2. If

#!/bin/bash# determine if the current user is rootif [$UID-eq 0];thenecho You is root user.elseecho you are nothing.fi


This article is from the "Xuan Bi Yun" blog, please be sure to keep this source http://rebybyx.blog.51cto.com/7262320/1676434

"Linux-shell" shell script basic grammar Exercises

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.