Let's say you opened a Git Bash console and used it for a time but you forgot if you opened it as Administrator or not.
Is there a way to check this in the current console, without closing and opening it again?
Adapted from the thread on how to check for admin rights, run the following:
if [[ $(sfc 2>&1 | tr -d '\0') =~ SCANNOW ]]; then echo Administrator; else echo $USERNAME; fi
If you are running git-bash
as Administrator, it will print Administrator
, otherwise it will print your username.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With