You can just use "if sg_persist --in --read-status $dev; then" here. Also, you're not using the sg_persist binary as configured via the resource attributes.