There are two kinds of paths in nsh: host-relative (/etc/passwd) and host-specific (//servername/etc/passwd).
The problem you are seeing is that if you are in the context of the computer that is running nsh (the localhost), then pwd (and $PWD) is a host-relative path.
It is a slightly unfortunate reality that the following does not always work in nsh:
There is a host called //@ which is the current localhost. So if you know you are on the localhost, instead, you can try:
So while we're on the subject, are there any other nsh-specific features (analogous to '@') which would be worth knowing about?
There is not a lot of nsh specific documentation but you can try:
Most people have enough to work with unix shell technologies -- if, while, for, test, ``, $VARIABLE, etc...
Some fun nsh commands:
n* (ntop, nover, ndf, nps, nnet, nmem...) - many standard commands that can be run in network enabled mode.
logman - looking at agent log files using nsh.
disconnect - disconnect from a server when you have used //server. Important if you are going to shutdown the agent.
I like '$NSH_RUNCMD_HOST', it is the current host on which the script is being executed.
I use it a lot in NSH scripts that I make NSH script jobs.
It allows me to use the 'run the script once using runscript' and not have to worry about iterating through the list of hosts that are passed to the script.
So for a script like this (called say, 'echo_servername.nsh'):
If you run it from the command line like so:
runscript -h host1 host2 -e echo_servername.nsh
You'll get output like:
==> host1 <==
==> host2 <==
Then you can create an nsh script job based on the script and use the 'run once using runscript' option. The group/list of servers you target with the job end up populating the -h option.
Thanks for the tip on the man page for nsh. That was actually (somewhat) useful. zsh doesn't really help me, as I believe nsh is a superset of zsh, but with the BL networking and security integrated. I'm more familiar with sh and bash, but that's a personal choice. Many many years of being familiar with if, while, for, test, ``, $VARIABLE, and the like, but that wasn't what I was asking for.
The n* commands are all referenced in the BladeLogicNSHCommands.pdf file. Alas, there's no joy when it comes to finding references to the built-ins which set nsh apart. I'd hoped to find them there, but.... That's actually where I first looked prior to my post.
In other words, what BL-specific functionality/variables/references/operators/etc set nsh apart from zsh? Is there a central reference somewhere, or is it passed through tribal knowledge?
Good deal, Aaron.
Okay, so now we have '@' and '$NSH_RUNCMD_HOST". That's two. Is that the list of nsh's uniqueness in its entirety?
I suspect not, but until I find the holy grail of an authoritative reference, the search will continue.