Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sample Analysis of shell script Distribution

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "sample analysis of shell script distribution", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of shell script distribution".

#! / bin/bash

# 1 get the number of input parameters of the command. If the number is 0, exit the command directly.

Paramnum= $#

If ((paramnum = = 0)); then

Echo no params

Exit

Fi

# 2 obtain the name of the piece according to the pass parameter

P1 = $1

File_name= `basename $p1`

Echo fname= $file_name

# 3 get the absolute path of input parameters

Pdir= `cd-P $(dirname $p1); pwd`

Echo pdir= $pdir

# 4 get the account name

User= `whoami`

# 5 cyclic implementation of rsync

For ((host = 101; host < 104; host + +)); do

Echo-linux $host-

Rsync-rvl $pdir / $file_name $user @ hadoop $host: $pdir

Done

The above is all the contents of the article "sample Analysis distributed by shell scripts". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report