Database Reference
In-Depth Information
variable called PATH . In a fresh install of the Data Science Toolbox, the PATH looks
like this:
$ echo $PATH | fold
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/loc
al/games:/home/vagrant/tools:/usr/lib/go/bin:/home/vagrant/.go/bin:/home/vagrant
/.data-science-at-the-command-line/tools:/home/vagrant/.bin
The directories are delimited by colons. Here is the list of directories:
$ echo $PATH | tr : '\n' | sort
/bin
/home/vagrant/.bin
/home/vagrant/.data-science-at-the-command-line/tools
/home/vagrant/.go/bin
/home/vagrant/tools
/sbin
/usr/bin
/usr/games
/usr/lib/go/bin
/usr/local/bin
/usr/local/games
/usr/local/sbin
/usr/sbin
To change the PATH permanently, you'll need to edit the .bashrc or .proile file located
in your home directory. If you put all your custom command-line tools into one
directory, say, ~/tools , then you'll only need to change the PATH once. As you can see,
the Data Science Toolbox already has /home/vagrant/.bin in its PATH . Now, you no
longer need to add the ./ , but you can just use the filename. Moreover, you no longer
need to remember where the command-line tool is, because you can use which to
locate it.
Creating Command-Line Tools with Python and R
The command-line tool that we created in the previous section was written in Bash.
(Sure, not every feature of the Bash language was employed, but the interpreter still
was bash .) As you may know by now, the command line is language agnostic, so we
do not necessarily have to use Bash for creating command-line tools.
In this section, we'll see that command-line tools can be created in other program‐
ming languages as well. We will focus on Python and R because these are currently
the two most popular programming languages within the data science community. A
complete introduction to these languages is outside the scope of this topic, so we
assume that you have some familiarity with Python and or R. Programming lan‐
guages such as Java, Go, and Julia follow a similar pattern when it comes to creating
command-line tools.
Search WWH ::




Custom Search