Hi I miss the modern feature of osx restoring session after reboot so I would like to write a bash script that save the pdf files open in Preview.app and ask if I want to reopen that files in preview.app if between the last 2 script execution the system has rebooted.
I begin with
lsof | grep '^Preview*pdf$' >> listpreview.txt
but I'm not able to determine the appropriate regex to isolate the path, a typical line returned by lsof
is
Preview 4581 My_user txt REG 14,2 3254550 36522430 /arbitrary_path/filename_with_all_sort_of_character_and_spaces.pdf
- There are more direct methods than lsof?
- How can I save a .txt file (?) with the list of path of pdf files used in preview.app?
- How escape all sort of symbol like ß may be (should not) in file/folder name?
Thanks for your answer.