Skip to content

Instantly share code, notes, and snippets.

@aderixon
Last active March 7, 2019 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aderixon/873fd92c887c99a4ee49605a8fb0b6bd to your computer and use it in GitHub Desktop.
Save aderixon/873fd92c887c99a4ee49605a8fb0b6bd to your computer and use it in GitHub Desktop.
Solaris 11.3 bug/oddity with remote zonecfg in loop
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