Hello I am trying to store an OS X command in a variable and I am having problems doing so. Here is my code:
#! /bin/bash
Output=$(dscl . -read /Users/root AuthenticationAuthority)
Check="No such key: AuthenticationAuthority"
if [ "$Output" = "$Check" ]
then
echo "OK"
else
echo "FALSE"
fi
I have done this before with commands such as "defaults read...." and it works fine but the dscl . -read will not store the output in the variable. Any ideas?
echo $Output, what happens?