Skip to content
Snippets Groups Projects
Commit 460a4f5b authored by nimrod's avatar nimrod
Browse files

Better error handling.

parent 805f64d0
No related branches found
No related tags found
No related merge requests found
#!/bin/sh -e #!/bin/sh -e
. "$1" . "$1"
if [ -z "$path" ] fail ()
then {
echo "failed=True msg=Path not set." echo "{\"failed\": true, \"msg\": \"$1\"}"
exit exit
fi }
if [ ! -r $path ] test -z "$path" && fail "Parameter 'path' is not set."
then test ! -r "$path" && fail "Can't access 'path'."
echo "failed=True msg=Can\'t access path." test ! -f "$path" && fail "Parameter 'path' doesn't exists or is not a file."
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 \ bits="$(openssl dhparam -in $path -text -noout \
| sed -n 's/[a-zA-Z#0-9 \-]*Parameters: (\([0-9]*\) bit)/\1/p')" | sed -n 's/[a-zA-Z#0-9 \-]*Parameters: (\([0-9]*\) bit)/\1/p')"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment