Comment Comment by chenxiaolong This should work with any arbitrary filename: latest=$(printf '%s\0' <glob> | sort -zrV | head -zn1) or with long args: latest=$(printf '%s\0' <glob> | sort --zero-terminated --reverse --version-sort | head --zero-terminated --lines 1 parent chenxiaolong 2 years ago