

Thanks! Typed this on mobile, must have missed the key
Programming and reading.


Thanks! Typed this on mobile, must have missed the key


For trailing whitespace agreed, but a whitespace in the middle of the file is not uncommon and should be properly handled.


If the filename has a space, a good solution without adjusting the files is to use quotes: "$FILENAME-synced.mkv"
Edit: generally, as a good practice, quote all variables. If you had FILENAME="my file"and tried to use it asffprobe $FILENAMEit wouldn't work, because variables are evaluated *before* interpreting the command, so effectively it evaluates toffprobe my file(two arguments).ffprobe "$FILENAME"on the other hand evaluates toffprobe “my file”` (onr argument) and works properly no matter the file name.


A script is just a list of commands. You can likely already execute your file as bash <filename> and get the same result. To use arguments, simply refer to them by number ($1 is the first argument, etc.).
Bonus: you can use a shebang to make it feel like an executable. Put /bin/bash as the first line, then make it executable via chmod +x <filename>, and now yoi can run it like ./<filename>


Why are you not simply writing a script with an argument? Why this cat indirection with environment variables?
For 2FA: Find a good password manager. They can also handle TOTP (the algorithm most 2FA implementations use), so you just autofill user & password, then autofill the TOTP, done. I use KeePassXC + sync the DB, but there are plenty of other trustworthy password managers. Plus, if you get in the habit of generating secure passwords using the password manager, one leaked login doesn’t cost you all of them.