Shell implementation Associative array

Source: Internet
Author: User

<title>Shell implementation Associative array</title> Shell implementation Associative array

Write the input and output of the array with the shell; there is a file, the first list of host names, the second column IP address, how to enter the hostname return IP address, shell write implementation;

Read  do    eval ${host}=${IP}  done so that you can directly echo the ${hostname}. 

A file only 1 columns of data, how to use the shell to find the sums of the 1 columns of data;

Read  do    sum=$ ((sum + N));  Done echo $sum

DATE:2015-01-17 10:18:23

Author:sunx

created:2015-01-20 Tue 13:04

Emacs 24.4.2 (ORG mode 8.2.10)

Validate

Shell implementation Associative array

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.