In this recipe, you will start a Julia process in the background and then pass commands to it via a named pipe:
- First, create a named pipe using the mkfifo command. We will call it pipe:
$ mkfifo pipe
- Check that a file named pipe was indeed created:
$ lspipe
- Now, start Julia as a background process. Direct its standard input from pipe, and send standard output to log.txt and standard error to err.txt:
$ julia <pipe >log.txt 2>err.txt &
- Before sending jobs to Julia, redirect the 3 descriptor to the named pipe:
$ exec 3>pipe
- Now, you are ready to start sending commands to Julia. For this, you can use the echo command:
$ echo "1+2" >&3
- Now, try sending a malformed expression:
$ echo "X" >&3
- Finally, send exit()