Home > OS >  Shell white for help
Shell white for help

Time:11-21

All bosses for help
If how use to judge the corresponding IP put download the corresponding content and generate $2 folder to download content into the
Assuming that
The host name use IP address
1 2 127.0.0.1
2, 3 127.0.0.2
3 4 127.0.0.3

Ip0.1 download/home/XXX. Conf
Ip0.2 download/etc/XXXX
Ip0.3 download/var/named/XXXXX


I have trouble, take a look at how


CodePudding user response:

Don't know you didn't say clear, or I didn't understand what you mean. IP directly if compare to several branches, each branch processing (download) not have the corresponding content

CodePudding user response:

ABC. TXT content is I say of these such

HFSSXXS DNS 127.0.0.1
HFSSSSS DHCP 127.0.0.2
Hfsssse radius 127.0.0.3
Cxfssse DNS 127.1.0.4
ZZFFFSSS DHCP 127.3.0.5
Ttjrejr radius 127.6.1.6


Through the $1 as basic variables, to do judgment, backup corresponding to different areas and the type of server configuration to the designated place
Such as HFSSXXS such generates begin with hf folder cxfssse cx folders are generated according to $2 to generate a folder name and then again the SCP to throw things take $3 IP which is convenient to judge IP SCP to

OLDIFS=$IFS
The IFS=$' \ n '

For the line in $(cat/home/ABC. TXT); Do
The host=$(echo $line | awk '} {print $1 ')
Name=$(echo $line | awk '{print $2}')
Hostip=$(echo $line | awk '{print $3}')

If []; Then

The else

Fi
Here is how I will receive the==don't know how to write the script

CodePudding user response:

Probably understand. In addition you have ambiguity the $1, this is parameters. I think half a day to recognize the host is $1 name is $2. Now only the seven kinds of pattern, right? The SCP to cp.? Cp?

CodePudding user response:

All DNS radius, the DHCP server needs to SCP file path is the same
So I want to according to his IP to identify the server and then to confirm the SCP of things I need and then into the corresponding folder
For example,
HFSSXXS DNS 127.0.0.1 SCP: "/etc/DHCP/DHCP. Conf/etc/DHCP/subnet configures"
HFSSSSS DHCP 127.0.0.2 SCP: "/etc/DHCP/DHCP. Conf/etc/DHCP/subnet configures"
Hfsssse radius 127.0.0.3 SPC: "/usr/local/etc/raddb/radiusd. Conf/usr/local/etc/raddb/mods - available/mschap"
Such like
Bosses and see that there has been no idea how to write my trouble

CodePudding user response:

  have bosses know ah
  • Related