One of the best features of Julia is its great REPL, which provides users with a lot of flexibility while calling OS-specific commands. For this book, I have been using a Linux-based operating system, and hence, going forward, all the commands used will be purely Linux-based. For users using Windows, the system commands would be different and native to the underlying OS.
To call any operating system command from inside the Julia REPL, we just have to press a ";" key and the prompt immediately changes:
julia >; # As soon as you press this ";"
shell >
The change in the prompt is immediate, and on the same line. To start with, Julia provides a command named pwd()
, which is synonymous with the one we used in a Linux operating system to discover a user's current directory:
shell> pwd
/home/myuser
julia> pwd()
"/home/myuser"
Notice closely, for the first command, we have used a ";" and then called the pwd
command in shell mode. While for the next...