Last active
March 7, 2019 12:33
-
-
Save aderixon/873fd92c887c99a4ee49605a8fb0b6bd to your computer and use it in GitHub Desktop.
Solaris 11.3 bug/oddity with remote zonecfg in loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Consider this script on Solaris 11.3: | |
#!/bin/ksh93 | |
echo "a\nb\nc" | while read val; do | |
echo "$val :" | |
ssh -q remotehost "zonecfg -z azone \"select capped-memory; end;\"" | |
done | |
When run, it will only execute the first iteration of the loop: | |
$ ./script.sh | |
a : | |
$ | |
BUT! It will work and run through every iteration if you use "ssh -n" instead (i.e. redirect /dev/null to stdin). | |
Theory: zonecfg reads from stdin every time, which interacts badly within a non-interactive shell (absorbs rest of loop input?). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment