Bash Check on Jupyter

Bash Check

  • toc:true- branch: master
  • badges: true
  • comments: true
  • author: Nicolas Mosqueda
  • categories: [Week 1]
  • image: images/chart-preview.png
echo "Using conditional statement to create a project directory and project"

# Variable section
export project_dir=$HOME/vscode  # change vscode to different name to test git clone
export project=$project_dir/APCSP  # change APCSP to name of project from git clone
export project_repo="https://github.com/nighthawkcoders/APCSP.git"  # change to project of choice

cd ~    # start in home directory

# Conditional block to make a project directory
if [ ! -d $project_dir ]
then 
    echo "Directory $project_dir does not exists... makinng directory $project_dir"
    mkdir -p $project_dir
fi
echo "Directory $project_dir exists." 

# Conditional block to git clone a project from project_repo
if [ ! -d $project ]
then
    echo "Directory $project does not exists... cloning $project_repo"
    cd $project_dir
    git clone $project_repo
    cd ~
fi
echo "Directory $project exists."
Using conditional statement to create a project directory and project
Directory /home/nicolasmosqueda/vscode exists.
Directory /home/nicolasmosqueda/vscode/APCSP exists.
echo "Navigate to project, then navigate to area wwhere files were cloned"
cd $project
pwd

echo ""
echo "list top level or root of files with project pulled from github"
ls

echo ""
echo "list again with hidden files pulled from github"
ls -a   # hidden files flag, many shell commands have flags

echo ""
echo "list all files in long format"
ls -al   # all files and long listing
Navigate to project, then navigate to area wwhere files were cloned
/home/nicolasmosqueda

list top level or root of files with project pulled from github
anaconda3  APCSP  vscode  wsl

list again with hidden files pulled from github
.          .bash_history  .gitconfig   .node-gyp                  .wget-hsts
..         .bash_logout   .ipython     .npm                       wsl
anaconda3  .bashrc        .jupyter     .profile
APCSP      .cache         .landscape   .sudo_as_admin_successful
.aws       .conda         .local       vscode
.azure     .docker        .motd_shown  .vscode-server

list all files in long format
total 88
drwxr-x--- 15 nicolasmosqueda nicolasmosqueda 4096 Sep 19 16:30 .
drwxr-xr-x  3 root            root            4096 Aug 21 23:27 ..
drwxr-xr-x 28 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:25 anaconda3
drwxr-xr-x 18 nicolasmosqueda nicolasmosqueda 4096 Aug 23 13:55 APCSP
lrwxrwxrwx  1 nicolasmosqueda nicolasmosqueda   23 Sep 19 16:30 .aws -> /mnt/c/Users/nicom/.aws
lrwxrwxrwx  1 nicolasmosqueda nicolasmosqueda   25 Sep 19 16:30 .azure -> /mnt/c/Users/nicom/.azure
-rw-------  1 nicolasmosqueda nicolasmosqueda 3216 Sep 23 14:25 .bash_history
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda  220 Jan  6  2022 .bash_logout
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda 4286 Sep 14 14:40 .bashrc
drwxr-xr-x  7 nicolasmosqueda nicolasmosqueda 4096 Sep 23 14:08 .cache
drwxr-xr-x  2 nicolasmosqueda nicolasmosqueda 4096 Sep 14 14:40 .conda
drwxr-xr-x  5 nicolasmosqueda nicolasmosqueda 4096 Sep 19 17:34 .docker
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda   34 Sep 14 14:28 .gitconfig
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 23 14:08 .ipython
drwxr-xr-x  2 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:24 .jupyter
drwxr-xr-x  2 nicolasmosqueda nicolasmosqueda 4096 Aug 21 23:30 .landscape
drwxr-xr-x  5 nicolasmosqueda nicolasmosqueda 4096 Sep 23 14:08 .local
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 25 16:41 .motd_shown
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:26 .node-gyp
drwxr-xr-x 13 nicolasmosqueda nicolasmosqueda 4096 Sep 23 14:01 .npm
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda  807 Jan  6  2022 .profile
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 14 14:42 .sudo_as_admin_successful
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:28 vscode
drwxr-xr-x  5 nicolasmosqueda nicolasmosqueda 4096 Aug 23 13:52 .vscode-server
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda  183 Sep 14 17:28 .wget-hsts
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 14 14:30 wsl
echo "Look for posts"
export posts=$project/_posts  # _posts inside project
cd $posts  # this should exist per fastpages
pwd  # present working directory
ls -l  # list posts
Look for posts
bash: cd: /_posts: No such file or directory
/home/nicolasmosqueda
total 12
drwxr-xr-x 28 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:25 anaconda3
drwxr-xr-x 18 nicolasmosqueda nicolasmosqueda 4096 Aug 23 13:55 APCSP
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:28 vscode
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 14 14:30 wsl
echo "Look for posts"
export posts=$project/_posts  # _posts inside project
cd $posts  # this should exist per fastpages
pwd  # present working directory
ls -l  # list posts
Look for posts
bash: cd: /_posts: No such file or directory
/home/nicolasmosqueda
total 12
drwxr-xr-x 28 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:25 anaconda3
drwxr-xr-x 18 nicolasmosqueda nicolasmosqueda 4096 Aug 23 13:55 APCSP
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:28 vscode
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 14 14:30 wsl
echo "Look for notebooks"
export notebooks=$project/_notebooks  # _notebooks is inside project
cd $notebooks   # this should exist per fastpages
pwd  # present working directory
ls -l  # list notebooks
Look for notebooks
bash: cd: /_notebooks: No such file or directory
/home/nicolasmosqueda
total 12
drwxr-xr-x 28 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:25 anaconda3
drwxr-xr-x 18 nicolasmosqueda nicolasmosqueda 4096 Aug 23 13:55 APCSP
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:28 vscode
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 14 14:30 wsl
echo "Look for images in notebooks, print working directory, list files"
cd $notebooks/images  # this should exist per fastpages
pwd
ls -l
Look for images in notebooks, print working directory, list files
bash: cd: /_notebooks/images: No such file or directory
/home/nicolasmosqueda
total 12
drwxr-xr-x 28 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:25 anaconda3
drwxr-xr-x 18 nicolasmosqueda nicolasmosqueda 4096 Aug 23 13:55 APCSP
drwxr-xr-x  3 nicolasmosqueda nicolasmosqueda 4096 Sep 14 17:28 vscode
-rw-r--r--  1 nicolasmosqueda nicolasmosqueda    0 Sep 14 14:30 wsl
echo "Navigate to project, then navigate to area wwhere files were cloned"

cd $project
echo "show the contents of README.md"
echo ""

cat README.md  # show contents of file, in this case markdown
echo ""
echo "end of README.md"
echo "Show the shell environment variables, key on left of equal value on right"
echo ""

env
cd $project

echo ""
echo "show the secrets of .git"
cd .git
ls -l

echo ""
echo "look at config file"
cat config