2 Replies Latest reply on Nov 15, 2012 10:06 AM by Lazar NameToUpdate

    NSH script

    Aurora Hermida



      I have to make a NSH script that verify if the patrol agent is corrupt.


      If I run the following instruction (shell) in the target server I get the right result:


      bash-3.2# echo 1 - cd "$(cat /etc/patrol.d/patrol.conf|grep common|sed -n '1p'|cut -d'=' -f2|sed 's/\/common/Z/g'|cut -d'Z' -f1|sed 's/ //g'|sed 's/\/$//g')"/Patrol3

          1 - cd /opt/bmc/patrol/Patrol3  ==> Result


      But when I try to do the NSH script with the following instruction to get the same result:


      nexec -nohup $HOST sh -c "echo 1 - cd $(cat /etc/patrol.d/patrol.conf|grep common|sed -n '1p'|cut -d'=' -f2|sed 's/\/common/Z/g'|cut -d'Z' -f

      1|sed 's/ //g'|sed 's/\/$//g')/Patrol3"


      I get the following result:

      cat: /etc/patrol.d/patrol.conf: No such file or directory ==> Result

      1 - cd /Patrol3 ==> Result


      What is wrong?



      Thanks in advance!