blcred cred -test -profile defaultProfile
if [[ $? -eq 1 ]]
blcred cred -acquire -profile defaultProfile -username BLAdmin -password mySecretPassword
blcli_setoption serviceProfileName defaultProfile
blcli_setoption roleName BLAdmins
You could also use a user_info.dat here and the -i option instead of the passwd in the clear text.
This keeps a lot of history, as well as making sure you have current creds when you start nsh. it will add a little lag to the nsh startup but I'd rather wait dong nothing than having to type in all of that every time i need to go in and run blcli stuff. This works on windows too in %USERPROFILE%