#!/bin/sh -e . "$1" if [ -z "$path" ] then echo "failed=True msg=Path not set." exit fi if [ ! -r $path ] then echo "failed=True msg=Can\'t access path." exit fi if [ ! -f $path ] then echo "failed=True msg=Path doesn't exist or is not a file." exit fi bits="$(openssl dhparam -in $path -text -noout \ | sed -n 's/[a-zA-Z#0-9 \-]*Parameters: (\([0-9]*\) bit)/\1/p')" echo "{ \"changed\": false, \"path\": \"$path\", \"bits\": $bits }"