incomplete output variable stored

140 views Asked by At

im actually working with a small script, this script uses a comand from a NAS EMC Storage, the main idea is to storage and output variable and use it for other command.

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


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

echo "$serverparam1" 

So.. this command nas_server -list -all | awk 'NR == 3 {print $6} returns "server_3"

the idea is to storage the name "server_3" and use it in this other command:

server_param server_3 -facility NDMP -list

The problem with all this stuff, is that the output print is not "server_3" only get "ver_3" i don't know why this is happening.

This is the ouput of the terminal:

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

This is the output from 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

Thanks

1

There are 1 answers

0
A.lacorazza On BEST ANSWER

This worked for me

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

nameserver1="$(dos2unix $nameserver)"

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

echo "$serverparam0"