I am writing an applescript that incorporates the unix command, ‘sdiff -s,’ that compares two similar text files and produces a list of words that differ between the two files. The problem is that this command seems to require file path addresses for both files compared (sdiff [OPTION]… FILE1 FILE2), instead of standard input of the file content from a variable. In other words, I would like to compare two lists of text data without referring to file addresses. Instead, I would like to feed the text data into the unix command ‘sdiff -s’ as the content of a regular variable. This way I don’t have to generate new files somewhere on the hard-drive, taking up space and requiring a special location. I believe I once figured out how to accomplish this task but have since forgotten. I am aware that one of the file addresses can take a dash that will serve to take standard input from a pipe (for example, echo hello | sdiff -s - /mySecondFileWithHelloMispelled). Nevertheless, this still requires at least one file reference.
By the way, a similar and perhaps easier problem exists for the unix ‘cat’ command. It too requires file references (or perhaps, one dash for one standard input) e.g. cat [-benstuv] [-] [file …]. I have not been able to find too many clues on how to get around using file references for these unix commands after scouring the web for a day or two–which makes me wonder why this aspect of unix is so inflexible. I know unix is based on input and output to files, however when writing scripts, it seems tidier to pass data between commands by way of variables.