Hey all,
I'm working on a script to rename permissions on accounts moved from Open Directory to Active Directory.
As part of the checks (while loop logic) to see if the account exists I am querying AD for the GUID of the account:
/usr/bin/dscl /Active Directory/$domain/All Domains/ -read /Users/$user GeneratedUID | /usr/bin/awk '{print $NF;}')"
This works great for accounts that do exist in that domain, but if they don't the command fails. (I might have mistyped this from my script, but the logic works ;) )
How can I capture this information into a variable, and have sterr ignore the cases where the command populating the variable fails?