3 Replies Latest reply on Oct 27, 2014 1:49 PM by Yanick Girouard

    NSH Script Job cat,grep,sed fails with argument list too long

      I'm running into a NSH shell limitation when executing cat , grep , sed against a file that contains over 2700 lines.  The file output contains output of the blcli command "Server showPermissions <servername>"

       

      A portion of the code is below:

      ================================================

      blcli_execute Server showPermissions ${servername} > /dev/null

      blcli_storeenv showpermissions

      echo "${showpermissions}" | grep -v '^$' > ${dir}/${filename}  #remove any blank lines

      cat ${dir}/${filename} | sed -e '/Policy Name:/,$d'   #return only the direct permissions and delete all lines after and including "Policy Name:"

      ===============================================

       

      I get the following errors when run from Bladelogic NSH Script Job.

       

      Error    Oct 24, 2014 3:54:24 PM    //@/usr/apps/bladelogic/NSH/tmp/job-vxpip-eblogc11/scripts/job__7817e701-5ff6-46cc-838d-58754a0c8e7c/script_DBKey-SJobKeyImpl-2167637-3__844f3dfe-9a6d-4c5d-a523-3f6a4b6e09de.2553005.1_RemoveDirectPermissions.nsh:165: arg list too long: /usr/apps/bladelogic/NSH/bin/grep

       

      Error    Oct 24, 2014 3:54:24 PM    //@/usr/apps/bladelogic/NSH/tmp/job-vxpip-eblogc11/scripts/job__7817e701-5ff6-46cc-838d-58754a0c8e7c/script_DBKey-SJobKeyImpl-2167637-3__844f3dfe-9a6d-4c5d-a523-3f6a4b6e09de.2553005.1_RemoveDirectPermissions.nsh:175: arg list too long: /usr/apps/bladelogic/NSH/bin/cat

       

      Error    Oct 24, 2014 3:54:24 PM    //@/usr/apps/bladelogic/NSH/tmp/job-vxpip-eblogc11/scripts/job__7817e701-5ff6-46cc-838d-58754a0c8e7c/script_DBKey-SJobKeyImpl-2167637-3__844f3dfe-9a6d-4c5d-a523-3f6a4b6e09de.2553005.1_RemoveDirectPermissions.nsh:175: arg list too long: /usr/apps/bladelogic/NSH/bin/sed