Determine com.apple.Finder AppleShowAllFiles status using command line? Is there a way that I can grab the status of com.apple.Finder AppleShowAllFiles in command line?

I switch between AppleShowAllFiles yes &amp; no frequently, I want to write a .command file to check if it's yes then switch to no and vice versa. I now get stuck at query the status of AppleShowAllFiles.
Thank you for comment from @Yoric

I found the answer from stackoverflow @Carter Allen

#!/bin/bash
#toggle AppleShowAllFiles

current_value=$(defaults read com.apple.finder AppleShowAllFiles)
if [ "$current_value" = TRUE ]
then
  defaults write com.apple.finder AppleShowAllFiles FALSE
else
  defaults write com.apple.finder AppleShowAllFiles TRUE
fi

killall Finder