All that aside, sudo rm -R Test_Dir should remove Test_Dir regardless of who the owner is because with sudo you are root.
Edit:
Sometimes it might be very useful to render a file immutable – nobody (not even the root user) will be able to edit, rename, move or delete this file. The way to do that on a Linux file system is by using file attributes (also called flags) and more specifically the “i“-immutable file attribute.
So you create a custom password that’s stored in the variable pass, it then echoes it to chattr so that it can make the file in %f immutable, am I right?
But what does the -S do? I’ve seen the man, but I don’t see the point- the stderr is the monitor, or is it redirecting to somewhere else?
In that code snippet, pass is not a variable - it is a plain text password and it gets transferred/echoed (trough pipe) to sudo. As sudo by default would transfer that toward command that is supposed to be run with elevated privileges (in this case chattr) one needs to explicitly set with --stdin different behaviour (i.e. sudo should consume stdin not chattr).
(At least that is what my brain think is going on. )