1

我实际上正在使用一个小脚本,该脚本使用来自 NAS EMC 存储的命令,主要思想是存储和输出变量并将其用于其他命令。

nameserver="$(nas_server -list -all | awk 'NR == 3 {print $6}')"


serverparam1="$(server_param "$nameserver" -facility NDMP -list)"

echo "$serverparam1" 

所以..这个命令nas_server -list -all | awk 'NR == 3 {print $6}返回“server_3”

这个想法是存储名称“server_3”并在其他命令中使用它:

server_param server_3 -facility NDMP -list

所有这些东西的问题在于,输出打印不是“server_3”,只有“ver_3”,我不知道为什么会这样。

这是终端的输出:

[nasadmin@xxxx ~]$ ./test.sh
 : ver_3
 : unknown hostver_3

这是 server_param 的输出

    [nasadmin@xxxx ~]$ server_param server_3 -facility NDMP -list
server_3 :
param_name                       facility  default     current   configured
maxProtocolVersion                  NDMP          4          4
scsiReserve                         NDMP          0          0
DHSMPassthrough                     NDMP          0          0
CDBFsinfoBufSizeInKB                NDMP       1024       1024
noxlt                               NDMP          0          0
bufsz                               NDMP        128        128
convDialect                         NDMP     8859-1     8859-1
concurrentDataStreams               NDMP          4          4
includeCkptFs                       NDMP          1          1
md5                                 NDMP          1          1
snapTimeout                         NDMP          5          5
dialect                             NDMP
forceRecursiveForNonDAR             NDMP          0          0
excludeSvtlFs                       NDMP          1          1
tapeSilveringStr                    NDMP         ts         ts
portRange                           NDMP 1024-65535 1024-65535
snapsure                            NDMP          0          0
v4OldTapeCompatible                 NDMP          1          1

    [nasadmin@xxxx ~]$ nas_server -list -all
id      type  acl  slot groupID  state  name
1        1    0     2              0    server_2
2        4    0     3              0    server_3

id       acl  server    mountedfs       rootfs  name
1        0    1         17              13      TEST_VDM-1
2        0    1         16              14      TEST_VDM-2

谢谢

4

1 回答 1

1

这对我有用

nameserver="$(nas_server -list -all  |  awk 'NR == 5 {print $6}')"

nameserver1="$(dos2unix $nameserver)"

serverparam0="$(server_param "$nameserver0" -facility NDMP -list)"

echo "$serverparam0"
于 2017-10-17T19:14:29.580 回答