3 Replies Latest reply on Mar 13, 2013 5:49 AM by Jim Wilson

    NSH man Pages

    John Landells

      Does anyone have any idea how to get the man pages working in NSH for BL8.2 SP2?  We only get the first screen of any man page, which is rarely helpful - especially since the old NSH reference PDF is no longer updated, and the docs site refers people back to the man pages!


      To be honest, it seems to be more than just man pages - the 'more' and 'less' commands are also broken, and commands like 'grep' and 'sed' seem to be severely restricted in comparison to what they used to be....


      Any ideas?




        • 1. Re: NSH man Pages
          Jim Wilson
          1 of 1 people found this helpful
          • 2. Re: NSH man Pages
            John Landells

            Thanks Jim, that WILL help, but a workaround for the current release that we're running whilst we plan to rollout a newer version would also be gratefully received!




            • 3. Re: NSH man Pages
              Jim Wilson

              TBH, I think the workaround is probably more work than applying a Service Pack, but here it is :


              This example fixes the formatting problem of the file output via the output redirection


              NSH Prompt% man runscript > runscript.txt

              NSH Prompt% vi runscript.txt

              execute following commands inside vi editor

              1. :%s/^H//g => here ^H is a single character generated by keypress "ctr+v+h"

              2. :%s/\([A-Z]\)\1/\1/g

              3. :%s/\([a-z]\)\1/\1/g

              4. :wq


              Now you can "vi runscript.txt" and navigate using "ctrl+f". Complete "man" output is available for you inside vi.

              This sequence would need to be completed for each new file that you create.


              The above sequence can be bundled into a script.


              [==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====]

              if [ $# -ne 1 ]; then
              echo "usage:"
              echo "nsh ./bmc-man.nsh <man_page_name>"
              exit 0

              echo "Please wait for man-page $1..."
              man $1 > $1.txt
              sed "s/ //g" $1.txt > $1.1
              sed "s/\([A-Z]\)\1/\1/g" $1.1 > $1.2
              sed "s/\([a-z]\)\1/\1/g" $1.2 > $1.txt
              rm $1.1 $1.2
              echo "Done. Reformatted output available in $1.txt."

              [==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====]


              Example Usage:


              server% chmod +x bmc-man.nsh

              server% ./bmc-man.nsh runscript

              Please wait for man-page runscript...

              Done. Reformatted output available in runscript.txt.

              server% vi runscript.txt


              I hope that the copy/paste of the script has not lost any formatting !!