Frequently asked questions about NSH


The topic provides the frequently asked questions related to NSH:

  • If I pass the "-profile" switch to the "blcred cred" command, will it override the profile set using BL_AUTH_PROFILE_NAME environment variable?

    Resolution: The -profile switch of blcred cred command overrides the profile set using environment variable BL_AUTH_PROFILE_NAME: This override applies only to the process of issuing the credential.

    However, it does not act as a profile selection during authentication against the NSH-Proxy. This selection still has to be made separately, either by setting the environment variable BL_AUTH_PROFILE_NAME, or by specifying the profile in the secure file.

  • In what language can an NSH script be written? Is there any sample script?

    Resolution: NSH is a shell similar to ZSH, BASH, etc. An NSH script can be written using a combination of commands of UNIX-like shell script and TrueSight Server Automation commands like cp, agentinfo, blcli, blquery, nexec, etc. 

    Sample script:  

    #!/bin/nsh

    If test "`uname --s`" != "WindowsNT"

    then
    UID_GID=`agentinfo 10.20.32.252 | egrep "User Permissions" | awk -F ':' '{print $2}' | awk '{print $1}'`
    UID=`echo $UID_GID | cut --d'/' --f1`
    GID=` echo $UID_GID | cut --d'/' --f2' 
    echo "Mapped User Id = $UID"
    echo "Mapped Group Id = $GID"
    fi

    exit 0
  • In the scriptutil command "scriptutil -h "TARGET.NAME" -s unauth_world_writable_file -x SCAN_FOLDER", what is the meaning of 'TARGET.NAME' and '-x SCAN_FOLDER'.

    Resolution : 'TARGET.NAME' and SCAN_FOLDER are properties that come from the User interface (UI) to scriptutil, when scriptutil is called from within the GUI. 
    So it would be something like the example:  

    FOO=server1
    Scriptutil -h $FOO ...
    Scriptutil -h $FOO -s <script> -x arg1 arg2 arg3 

    Where arg1, arg2, arg3 are input parameters to script. 

    If x is set to -1 then, all directories are searched.

  • If the server has an interface which is neither connected to network nor configured, will nnet provide information about that interface.

    Resolution: nnet retrieves information of interfaces installed on the system from the kernel, so the relevant information would be present irrespective of the state of interface.

  • How do I pass parameters to an NSH script?

    Resolution: See Add-NSH-Script-Parameters and Add-NSH-Script-Script-Options for details.

    The values that you pass in the Value box get passed to the scripts as arguments. If you pass 3 values, inside the script, you can access them with $1, $2 and $3.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*