Work with Files and Data on the Command Line Using Wolfram Cloud
WolframScript can operate on files without any local kernel present using the Wolfram Cloud. Start by producing a text file using a cloud kernel.
Create a script file called FindPath.wls using a cloud kernel as the interpreter with the following content.
#!/usr/local/bin/wolframscript -cloud -print -format PNG
samples = ImportString[$ScriptInputString, "JSON"];
order = Last[FindShortestTour[samples]];
tour = samples[[order]];
Show[ListPlot[samples], Graphics[Line[tour]]]
The script can be executed from the command line using the local text file as input.
Import the code into a notebook.
In[1]:=
Import[FileNameJoin[{$HomeDirectory, "examples", "tour.png"}], "PNG"]
Out[1]=