Sample Analysis of shell script Distribution
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!