For a given file one may issue the bash command:
ls -la --full-time --time-style long-iso --time-style=+"%Y-%m-%d %H:%M:%S" file
This works of course.
I have a larger script in which I would like to define the time-style and to reference it multiple times:
TMP_TIME_STYLE="--full-time --time-style long-iso --time-style=+""%Y-%m-%d %H:%M:%S"""
Executing the command
ls -la ${TMP_TIME_STYLE} file
results in the error message:
ls: accessing '%Y-%m-%d' is not possible: no such file or directory.
It seems that not all the options in ${TMP_TIME_STYLE} are passed to ls.
I already tried to put additional "" just in front of %Y-%m-%d and immediately behind %H:%M:%S, however the same error message.
How to safely pass the contents of ${TMP_TIME_STYLE} to ls?