On Sep 24 2025, Stan Marsh wrote:
>>> Example (if possible):
>>> --------------------------
>>> $ chmod 777 -t 30 myfile.txt
>>> # Grants full access to "myfile.txt" for 30 minutes
>>> # After 30 minutes, permissions revert to their previous state
>
>>$ chmod-t() { local m=$(stat -c %a "$2"); chmod "$1" "$2"; sleep ${3}m; chmod
>>$m "$2"; }
>>$ chmod-t 777 myfile.txt 30
>
> Except that, of course, no one would ever do it like that.
>
> The whole point is that you want the command to return immediately,
> but have a background process/thread running to chmod it back.
$ chmod-t 777 myfile.txt 30 &
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."