It looks like the strings command is probably crashing. Here's what I see:
machine% PROPS="a = b"
machine% noglob echo $PROPS | strings -n 1
a = b
machine% echo $?
Notice 'strings -n 1' is returning an exit code of 11 which is typically a crash.
The strings command was updated between 8.0 and 8.2 so I'd recommend opening a support ticket on this.
i've already opened a ticket, i was just curious if someone already stumbled on it.
i'm planning a migration to 8.2 on an environment that uses lots of scripting, so i don't really know what to expect.
my behaviour is a little different than your:
BL02WP1C% PROPS="a = b"
BL02WP1C% noglob echo $PROPS | strings -n 1
a = b
BL02WP1C% echo $?
notice that the return code is different and anyway "strings" does its work by printing "a = b"
even more strange is this permutation of the original command
BL02WP1C% noglob echo $PROPS | sed "s/ = /=/g" | strings -n 1
BL02WP1C% echo $?
where everything works (just the command sequence is not what i really need).
it seems that "strings" does not crash at all.
1 of 1 people found this helpful
Strings is still crashing. The difference between yours and mine though is that it crashes with exit code 11 on Linux and crashes with exit code 6 on Windows. I just tried in a windows environment and got the same results as you. Strings can only return an exit code of either 0 or 1 so getting any other value means that it crashed.
Your getting some output though because strings did do a little bit of processing before crashing. The output never really goes anywhere though because it's not standard output. Try the following:
noglob echo $PROPS | strings -n 1 > out1 2>out2
If you check out both files though you'll see that they're empty. This is why no output is getting passed on to the sed command.
In your test of "noglob echo $PROPS | sed "s/ = /=/g" | strings -n 1". This just appears to work because the
echo output successfully goes to sed which successfully processes it which then passes it on to strings.
Strings then crashes. If you were to add one more | like:
noglob echo $PROPS | sed "s/ = /=/g" | strings -n 1 | cat
You'd see that you're still getting no output.
It seems to be a problem on 8.2 (and 8.1 as well). Look at this test:
1. I copied a strings.exe binary coming from BL 8.0 SP7 into a BL 8.2 <BLADELOGIC>\NSH\bin folder
2. Executed the command in a 8.2 NSH prompt:
you can see it worked fine, so can we assume that something is changed in the Cygwin used in 8.2?
The following enhancement was done in 8.1 service pack 2.
Internationalization support for NSH commands
The majority of NSH commands now support multibyte characters for
internationalization (I18N). This support enables you to input text in a variety of
languages within your NSH commands
The strings command was one of the commands updated as part of this enhancement. And the crash most
likely comes fromthis updated strings command. 8.2 contains everything from 8.1 service pack 2 which is why it's
broken as well.