I'm trying to write a bash script that inverts the given file's group permissions. For example:
if file.txt had the permissions -rw-r--r--, it would be inverted to -rw--wxr--
if file.txt had the permissions -rw--w-r-x, it would be inverted to -rw-r-xr-x
I've done something similar to this in python before, where I used the XOR bitwise operator ^ to invert the execute permissions.
I can't seem to figure out the proper way of doing this in bash The filename will be provided as a command line argument