I have the following command stored in a shell script variable.
x='gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output3.pdf /usr/share/ghostscript/8.70/lib/viewjpeg.ps -c "(PO-31649-1.jpg) viewJPEG showpage (PO-31649-2.jpg) viewJPEG showpage (PO-31649-3.jpg) viewJPEG showpage"'
When I execute the gs command directly on the command prompt, it creates output3.pdf. However, when assign that command to a shell variable and execute the script, it errors out as follows:
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
How do I execute a command stored in a variable? Any help would be appreciated.