Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Getting started with Julia Programming Language

You're reading from   Getting started with Julia Programming Language Enter the exciting world of Julia, a high-performance language for technical computing

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781783284795
Length 214 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivo Balbaert Ivo Balbaert
Author Profile Icon Ivo Balbaert
Ivo Balbaert
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface The Rationale for Julia FREE CHAPTER 1. Installing the Julia Platform 2. Variables, Types, and Operations 3. Functions 4. Control Flow 5. Collection Types 6. More on Types, Methods, and Modules 7. Metaprogramming in Julia 8. I/O, Networking, and Parallel Computing 9. Running External Programs 10. The Standard Library and Packages A. List of Macros and Packages Index

Running shell commands


To interact with the operating system from within the Julia REPL, there are a few helper functions available as follows:

  • pwd(): This function prints the current directory, for example, "d:\\test"

  • cd("d:\\test\\week1"): This function helps to navigate to subdirectories

  • In the interactive shell, you can also use the shell mode using the ; modifier:

    • ; ls: This prints, for example, file1.txt shell.jl test.txt tosort.txt

    • ; mkdir folder: This makes a directory named folder

    • ; cd folder: This helps to navigate to folder

However, what if you want to run a shell command by the operating system (the OS)? Julia offers an efficient shell integration through the run function, which takes an object of type Cmd that is defined by enclosing a command string in backticks (``):

# Code in Chapter 9\shell.jl:
   cmd = `echo Julia is smart`
typeof(cmd) #> Cmd 
    run(cmd) # returns Julia is smart
    run(`date`) #> Sun Oct 12 09:44:50 GMT 2014
cmd = `cat file1.txt`
run(cmd) ...
lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Getting started with Julia Programming Language
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon