I'm trying to open a PDF using Preview where the input file is a shell var:
$ pdf=$(wget -qO- 'http://website.com/file.pdf') && open "$pdf"
$ pdf=$(wget -qO- 'http://website.com/file.pdf') && open -a /Applications/Preview.app -f "$pdf"
$ open -a /Applications/Preview.app $(wget -qO- 'http://website.com/file.pdf')
$ pdf=$(wget -qO- 'http://website.com/file.pdf') | open -a /Applications/Preview.app -f -
etc etc etc
I always get the same error:
-bash: /usr/bin/open: Argument list too long
Is it possible to do this?
example PDF for anyone who wants to try:
https://www.exploit-db.com/docs/english/44592-linux-restricted-shell-bypass-guide.pdf
Best Answer
Cool problem showing how amazing bash, pipes and open are. You are so close on the fourth try:
Luckily the
-a
argument lets the-f
take the data from stdin but not open in TextEdit.