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/syeung2/vscode exists.
Directory /home/syeung2/vscode/APCSP does not exists... cloning https://github.com/nighthawkcoders/APCSP.git
Cloning into 'APCSP'...
remote: Enumerating objects: 9173, done.
remote: Counting objects: 100% (748/748), done.
remote: Compressing objects: 100% (313/313), done.
remote: Total 9173 (delta 454), reused 702 (delta 414), pack-reused 8425
Receiving objects: 100% (9173/9173), 16.49 MiB | 12.58 MiB/s, done.
Resolving deltas: 100% (4949/4949), done.
Directory /home/syeung2/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/syeung2/vscode/APCSP

list top level or root of files with project pulled from github
Gemfile    _action_files    _layouts    _posts  docker-compose.yml
LICENSE    _config.yml      _notebooks  _sass   images
Makefile   _fastpages_docs  _pages      _word   index.html
README.md  _includes        _plugins    assets  python

list again with hidden files pulled from github
.                   .gitignore  _action_files    _pages    docker-compose.yml
..                  .vscode     _config.yml      _plugins  images
.devcontainer.json  Gemfile     _fastpages_docs  _posts    index.html
.git                LICENSE     _includes        _sass     python
.gitattributes      Makefile    _layouts         _word
.github             README.md   _notebooks       assets

list all files in long format
total 120
drwxr-xr-x 18 syeung2 syeung2  4096 Aug 25 22:34 .
drwxr-xr-x  4 syeung2 syeung2  4096 Aug 25 22:34 ..
-rw-r--r--  1 syeung2 syeung2   420 Aug 25 22:34 .devcontainer.json
drwxr-xr-x  8 syeung2 syeung2  4096 Aug 25 22:34 .git
-rw-r--r--  1 syeung2 syeung2    84 Aug 25 22:34 .gitattributes
drwxr-xr-x  4 syeung2 syeung2  4096 Aug 25 22:34 .github
-rw-r--r--  1 syeung2 syeung2   917 Aug 25 22:34 .gitignore
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 .vscode
-rwxr-xr-x  1 syeung2 syeung2  1304 Aug 25 22:34 Gemfile
-rw-r--r--  1 syeung2 syeung2 11351 Aug 25 22:34 LICENSE
-rwxr-xr-x  1 syeung2 syeung2  1422 Aug 25 22:34 Makefile
-rwxr-xr-x  1 syeung2 syeung2  3614 Aug 25 22:34 README.md
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _action_files
-rw-r--r--  1 syeung2 syeung2  3716 Aug 25 22:34 _config.yml
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _fastpages_docs
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _includes
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _layouts
drwxr-xr-x  3 syeung2 syeung2  4096 Aug 25 22:34 _notebooks
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _pages
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _plugins
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _posts
drwxr-xr-x  3 syeung2 syeung2  4096 Aug 25 22:34 _sass
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 _word
drwxr-xr-x  4 syeung2 syeung2  4096 Aug 25 22:34 assets
-rwxr-xr-x  1 syeung2 syeung2  1136 Aug 25 22:34 docker-compose.yml
drwxr-xr-x  5 syeung2 syeung2  4096 Aug 25 22:34 images
-rw-r--r--  1 syeung2 syeung2  1061 Aug 25 22:34 index.html
drwxr-xr-x  2 syeung2 syeung2  4096 Aug 25 22:34 python
test=python3 # keyword
check=`jupyter kernelspec list | grep $test` # run command
n=${#check} # determine length
if [[ ${n} > 0 ]];  # testt length
then # greater than zero
    echo “$check
else # less than zero
    echo “$check
fi
“”
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
/home/syeung2/vscode/APCSP/_posts
total 228
-rw-r--r-- 1 syeung2 syeung2 21306 Aug 25 22:34 2022-06-01-TT160-deploy.md
-rw-r--r-- 1 syeung2 syeung2  5861 Aug 25 22:34 2022-07-07-PBL-binary.md
-rw-r--r-- 1 syeung2 syeung2  3085 Aug 25 22:34 2022-07-08-PBL-grade_calc.md
-rw-r--r-- 1 syeung2 syeung2  3698 Aug 25 22:34 2022-07-08-PBL-graph.md
-rw-r--r-- 1 syeung2 syeung2  5729 Aug 25 22:34 2022-07-08-PBL-life.md
-rw-r--r-- 1 syeung2 syeung2 14387 Aug 25 22:34 2022-07-08-PBL-snake.md
-rw-r--r-- 1 syeung2 syeung2   334 Aug 25 22:34 2022-07-10-PBL-database.md
-rw-r--r-- 1 syeung2 syeung2  2908 Aug 25 22:34 2022-07-10-PBL-jokes.md
-rw-r--r-- 1 syeung2 syeung2  4046 Aug 25 22:34 2022-07-10-PBL-rapidapi.md
-rw-r--r-- 1 syeung2 syeung2  6685 Aug 25 22:34 2022-07-19-PBL-calculator.md
-rw-r--r-- 1 syeung2 syeung2 23325 Aug 25 22:34 2022-07-25-CSP-workshop.md
-rw-r--r-- 1 syeung2 syeung2  2333 Aug 25 22:34 2022-08-15-TP000-student_score_history.md
-rw-r--r-- 1 syeung2 syeung2  4363 Aug 25 22:34 2022-08-15-TP100-pseudo_code.md
-rw-r--r-- 1 syeung2 syeung2  7968 Aug 25 22:34 2022-08-15-TR100-tool_setup.md
-rw-r--r-- 1 syeung2 syeung2 15409 Aug 25 22:34 2022-08-15-TT100-tools.md
-rw-r--r-- 1 syeung2 syeung2  5590 Aug 25 22:34 2022-08-15-TT101-vscode-wsl.md
-rw-r--r-- 1 syeung2 syeung2  2155 Aug 25 22:34 2022-08-22-TR110-intro_python.md
-rw-r--r-- 1 syeung2 syeung2  5173 Aug 25 22:34 2022-08-22-TT110-fastpages.md
-rw-r--r-- 1 syeung2 syeung2  2798 Aug 25 22:34 2022-08-22-TT110-focus.md
-rw-r--r-- 1 syeung2 syeung2  2737 Aug 25 22:34 2022-08-29-TR120-data_abstract.md
-rw-r--r-- 1 syeung2 syeung2 10683 Aug 25 22:34 2022-08-29-TT120-agile.md
-rw-r--r-- 1 syeung2 syeung2  4498 Aug 25 22:34 2022-08-29-TT120-html_fragments.md
-rw-r--r-- 1 syeung2 syeung2  9037 Aug 25 22:34 2022-09-05-TP130-create_performance_task.md
-rw-r--r-- 1 syeung2 syeung2  7753 Aug 25 22:34 2022-09-05-TP131-create-task-bria.md
-rw-r--r-- 1 syeung2 syeung2  8066 Aug 25 22:34 2022-09-05-TR130-creative_development.md
-rw-r--r-- 1 syeung2 syeung2  3520 Aug 25 22:34 2022-09-05-TT130-applab.md
-rw-r--r-- 1 syeung2 syeung2   720 Aug 25 22:34 README.md