! [ -e /content ] && pip install -Uqq fastbook

Good morning;
I am getting started in deep learning, through this wonderful resource that is the Fastai MOOC. As I am totally a beginner, there are things that are surely very basic, but I still do not understand them. In the notebook in lesson 2, in the first cell (before importing the code, the first line of the code is:
``` ! [ -e /content ] && pip install -Uqq fastbook.````
Is it a directive? What exactly does it mean?
Thank you

“!” → tells Jupyter notebook to pass the remaining line to bash shell

[ -e /content ] → is the command in bash to check if a file or directory exists and returns true or false. So, here we’re checking if a directory called content exists at the path /content (/ is the root directory and content would be right under it if it exists)

&& → it means “If the last command returned True, run the next command.” So we just checked whether a directory /content exists or not. If it exists we’ll move on to running the command that comes after “&&” since the output of [ -e /content] would be “true”

pip install -Uqq fastbook → install fastbook package and Upgraded it (-U) if it already exists. -qq means be very very quiet?

3 Likes

I understood, Thank you!!!

1 Like