Using zkCli.sh,
create -s /myznode “Hello World!” null
creates a znode using the string "Hello World!"
How do I get it to use the contents of a file instead of a string?
If you look at ZooKeeperMain.java you can see that the only args it takes on the command line are for the server host and port to connect to.
If you then look at the method processZKCmd() you can see that it only takes arguments for sequential and ephemeral.
You can however send input to the command, e.g. ./zkCli.sh < script
where script contains "create mynode null"
From there it's not a long way to creating an input file that is itself created from the contents of a file. For example:
echo "create `cat myfile` > script; ./zkCli.sh < script
Bear in mind that zk nodes should be of fairly small size.