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/APCSA  # change APCSA to name of project from git clone
export project_repo="https://github.com/nighthawkcoders/APCSA.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/aadya/vscode exists.
Directory /home/aadya/vscode/APCSA does not exists... cloning https://github.com/nighthawkcoders/APCSA.git
Cloning into 'APCSA'...
remote: Enumerating objects: 8951, done.
remote: Counting objects: 100% (428/428), done.
remote: Compressing objects: 100% (206/206), done.
remote: Total 8951 (delta 248), reused 380 (delta 213), pack-reused 8523
Receiving objects: 100% (8951/8951), 14.50 MiB | 1.78 MiB/s, done.
Resolving deltas: 100% (5022/5022), done.
Directory /home/aadya/vscode/APCSA exists.

lis (ls)

ls is used to list all the directories in the main directory. ls -a is used to list all the hidden files

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

cd /home/aadya/vscode/APCSA_indiv_repo_tri1/
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/aadya

list top level or root of files with project pulled from github
APCSA                                ijava-1.3.0.zip
Anaconda3-2022.05-Linux-x86_64.sh    install.py
Anaconda3-2022.05-Linux-x86_64.sh.1  java
Anaconda3-2022.05-Linux-x86_64.sh.2  junk
Anaconda3-2022.05-Linux-x86_64.sh.3  vscode
anaconda3

list again with hidden files pulled from github
.              .landscape                 .wget-hsts
..             .lesshst                   APCSA
.bash_history  .local                     Anaconda3-2022.05-Linux-x86_64.sh
.bash_logout   .m2                        Anaconda3-2022.05-Linux-x86_64.sh.1
.bashrc        .motd_shown                Anaconda3-2022.05-Linux-x86_64.sh.2
.cache         .node-gyp                  Anaconda3-2022.05-Linux-x86_64.sh.3
.conda         .npm                       anaconda3
.config        .profile                   ijava-1.3.0.zip
.dbus          .sudo_as_admin_successful  install.py
.gitconfig     .vim                       java
.ipython       .viminfo                   junk
.jupyter       .vscode-server             vscode
bash: cd: /home/aadya/vscode/APCSA_indiv_repo_tri1/: No such file or directory

list all files in long format
total 2702080
drwxr-xr-x 20 aadya aadya      4096 Aug 23 08:50 .
drwxr-xr-x  3 root  root       4096 Aug 18 22:39 ..
-rw-------  1 aadya aadya     15229 Aug 26 00:22 .bash_history
-rw-r--r--  1 aadya aadya       220 Aug 18 22:39 .bash_logout
-rw-r--r--  1 aadya aadya      4246 Aug 19 09:38 .bashrc
drwxr-xr-x  7 aadya aadya      4096 Aug 23 08:50 .cache
drwxr-xr-x  2 aadya aadya      4096 Aug 19 09:23 .conda
drwxr-xr-x  3 aadya aadya      4096 Aug 23 08:50 .config
drwx------  3 aadya aadya      4096 Aug 20 17:56 .dbus
-rw-r--r--  1 aadya aadya        56 Aug 18 22:51 .gitconfig
drwxr-xr-x  3 aadya aadya      4096 Aug 20 18:46 .ipython
drwxr-xr-x  2 aadya aadya      4096 Aug 20 11:29 .jupyter
drwxr-xr-x  2 aadya aadya      4096 Aug 18 22:39 .landscape
-rw-------  1 aadya aadya        28 Aug 20 18:35 .lesshst
drwxr-xr-x  5 aadya aadya      4096 Aug 20 18:46 .local
drwxr-xr-x  3 aadya aadya      4096 Aug 21 21:48 .m2
-rw-r--r--  1 aadya aadya         0 Aug 26 08:36 .motd_shown
drwxr-xr-x  3 aadya aadya      4096 Aug 20 11:30 .node-gyp
drwxr-xr-x 13 aadya aadya      4096 Aug 20 16:27 .npm
-rw-r--r--  1 aadya aadya       807 Aug 18 22:39 .profile
-rw-r--r--  1 aadya aadya         0 Aug 18 22:44 .sudo_as_admin_successful
drwxr-xr-x  2 aadya aadya      4096 Aug 21 19:39 .vim
-rw-------  1 aadya aadya       805 Aug 21 19:39 .viminfo
drwxr-xr-x  5 aadya aadya      4096 Aug 18 23:03 .vscode-server
-rw-r--r--  1 aadya aadya       218 Aug 20 18:58 .wget-hsts
drwxr-xr-x 17 aadya aadya      4096 Aug 23 08:46 APCSA
-rwxr-xr-x  1 aadya aadya 690850711 May 10 11:35 Anaconda3-2022.05-Linux-x86_64.sh
-rw-r--r--  1 aadya aadya 690850711 May 10 11:35 Anaconda3-2022.05-Linux-x86_64.sh.1
-rw-r--r--  1 aadya aadya 690850711 May 10 11:35 Anaconda3-2022.05-Linux-x86_64.sh.2
-rw-r--r--  1 aadya aadya 690850711 May 10 11:35 Anaconda3-2022.05-Linux-x86_64.sh.3
drwxr-xr-x 28 aadya aadya      4096 Aug 20 11:29 anaconda3
-rw-r--r--  1 aadya aadya   3366077 Dec  6  2021 ijava-1.3.0.zip
-rw-r--r--  1 aadya aadya      7471 May  5  2019 install.py
drwxr-xr-x  3 aadya aadya      4096 May  5  2019 java
drwxr-xr-x  4 aadya aadya      4096 Aug 21 20:08 junk
drwxr-xr-x 20 aadya aadya      4096 Aug 25 23:11 vscode

all the posts appear

ls -l does this function, as cd is set to the posts folder

echo "Look for posts"
export posts=$project/_posts  # _posts inside project
cd $posts  # this should exist per fastpages
pwd  # present working directory
cd /home/aadya/vscode/APCSA_indiv_repo_tri1/_posts

ls -l  # list posts
Look for posts
bash: cd: /_posts: No such file or directory
/home/aadya/vscode/apcsa_indiv_repo_tri1/_notebooks
bash: cd: /home/aadya/vscode/APCSA_indiv_repo_tri1/_posts: No such file or directory
total 3144
-rw-r--r-- 1 aadya aadya 3162470 Aug 21 19:36 2020-02-20-test.ipynb
-rw-r--r-- 1 aadya aadya     888 Aug 24 10:16 2022-08-20-java.ipynb
-rw-r--r-- 1 aadya aadya     941 Aug 23 22:26 2022-08-20-python.ipynb
-rw-r--r-- 1 aadya aadya    4288 Aug 25 22:57 2022-08-24-score_calculator.ipynb
-rw-r--r-- 1 aadya aadya   23435 Aug 25 23:18 2022-08-25-bash_kernel.ipynb
-rw-r--r-- 1 aadya aadya     771 Aug 21 19:36 README.md
drwxr-xr-x 2 aadya aadya    4096 Aug 21 19:36 ghtop_images
drwxr-xr-x 2 aadya aadya    4096 Aug 21 19:36 my_icons

All the notebook files appear

ls -l does this function, as cd is set to the notebooks folder

echo "Look for notebooks"
export notebooks=$project/_notebooks  # _notebooks is inside project
cd $notebooks   # this should exist per fastpages
pwd  # present working directory

cd /home/aadya/vscode/APCSA_indiv_repo_tri1/_notebooks
ls -l  # list notebooks
Look for notebooks
bash: cd: /_notebooks: No such file or directory
/home/aadya/vscode/apcsa_indiv_repo_tri1/_notebooks
bash: cd: /home/aadya/vscode/APCSA_indiv_repo_tri1/_notebooks: No such file or directory
total 3144
-rw-r--r-- 1 aadya aadya 3162470 Aug 21 19:36 2020-02-20-test.ipynb
-rw-r--r-- 1 aadya aadya     888 Aug 24 10:16 2022-08-20-java.ipynb
-rw-r--r-- 1 aadya aadya     941 Aug 23 22:26 2022-08-20-python.ipynb
-rw-r--r-- 1 aadya aadya    4288 Aug 25 22:57 2022-08-24-score_calculator.ipynb
-rw-r--r-- 1 aadya aadya   23435 Aug 25 23:18 2022-08-25-bash_kernel.ipynb
-rw-r--r-- 1 aadya aadya     771 Aug 21 19:36 README.md
drwxr-xr-x 2 aadya aadya    4096 Aug 21 19:36 ghtop_images
drwxr-xr-x 2 aadya aadya    4096 Aug 21 19:36 my_icons

This returns the contents in the read me file

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
cd /home/aadya/vscode/APCSA_indiv_repo_tri1/README.md

echo ""
echo "end of README.md"
Navigate to project, then navigate to area wwhere files were cloned
show the contents of README.md

cat: README.md: No such file or directory
bash: cd: /home/aadya/vscode/APCSA_indiv_repo_tri1/README.md: No such file or directory

end of README.md

env

env command is for the enviroment. It returns all the environments that have been set up. We can check whether all the required environments have been set.

echo "Show the shell environment variables, key on left of equal value on right"
echo ""

env
Show the shell environment variables, key on left of equal value on right

SHELL=/bin/bash
PYTHONUNBUFFERED=1
project=/home/aadya/vscode/APCSA
CONDA_EXE=/home/aadya/anaconda3/bin/conda
_CE_M=
WSL_DISTRO_NAME=Ubuntu
ELECTRON_RUN_AS_NODE=1
VSCODE_AMD_ENTRYPOINT=vs/workbench/api/node/extensionHostProcess
NAME=Code
PWD=/home/aadya/vscode/APCSA
LOGNAME=aadya
CONDA_PREFIX=/home/aadya/anaconda3
MOTD_SHOWN=update-motd
project_dir=/home/aadya/vscode
HOME=/home/aadya
LANG=C.UTF-8
WSL_INTEROP=/run/WSL/8_interop
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
WAYLAND_DISPLAY=wayland-0
CONDA_PROMPT_MODIFIER=(base) 
PYDEVD_USE_FRAME_EVAL=NO
posts=/home/aadya/vscode/APCSA/_posts
LESSCLOSE=/usr/bin/lesspipe %s %s
VSCODE_HANDLES_SIGPIPE=true
TERM=xterm-256color
_CE_CONDA=
LESSOPEN=| /usr/bin/lesspipe %s
USER=aadya
PYTHONIOENCODING=utf-8
notebooks=/home/aadya/vscode/APCSA/_notebooks
CONDA_SHLVL=1
DISPLAY=:0
SHLVL=2
PAGER=cat
project_repo=https://github.com/nighthawkcoders/APCSA.git
VSCODE_CWD=/mnt/c/Aadya
CONDA_PYTHON_EXE=/home/aadya/anaconda3/bin/python
XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir
PS1=[PEXP\[\]ECT_PROMPT>
CONDA_DEFAULT_ENV=base
WSLENV=ELECTRON_RUN_AS_NODE/w:
VSCODE_WSL_EXT_LOCATION=/mnt/c/Users/prash/.vscode/extensions/ms-vscode-remote.remote-wsl-0.66.3
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/home/aadya/.vscode-server/bin/e4503b30fc78200f846c62cf8091b76ff5547662/bin/remote-cli:/home/aadya/.local/bin:/home/aadya/anaconda3/bin:/home/aadya/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Users/prash/AppData/Local/Microsoft/WindowsApps:/mnt/c/Aadya/bin:/snap/bin
VSCODE_NLS_CONFIG={"locale":"en","availableLanguages":{}}
HOSTTYPE=x86_64
PULSE_SERVER=/mnt/wslg/PulseServer
VSCODE_HANDLES_UNCAUGHT_ERRORS=true
OLDPWD=/home/aadya/vscode/APCSA/_notebooks
VSCODE_IPC_HOOK_CLI=/mnt/wslg/runtime-dir/vscode-ipc-d123d553-5453-4217-b8bb-4bfec6326687.sock
_=/usr/bin/env
cd $project

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

echo ""
echo "look at config file"
cat config
show the secrets of .git
total 60
-rw-r--r-- 1 aadya aadya    23 Aug 25 23:11 HEAD
drwxr-xr-x 2 aadya aadya  4096 Aug 25 23:11 branches
-rw-r--r-- 1 aadya aadya   269 Aug 25 23:11 config
-rw-r--r-- 1 aadya aadya    73 Aug 25 23:11 description
drwxr-xr-x 2 aadya aadya  4096 Aug 25 23:11 hooks
-rw-r--r-- 1 aadya aadya 20422 Aug 25 23:11 index
drwxr-xr-x 2 aadya aadya  4096 Aug 25 23:11 info
drwxr-xr-x 3 aadya aadya  4096 Aug 25 23:11 logs
drwxr-xr-x 4 aadya aadya  4096 Aug 25 23:11 objects
-rw-r--r-- 1 aadya aadya   271 Aug 25 23:11 packed-refs
drwxr-xr-x 5 aadya aadya  4096 Aug 25 23:11 refs

look at config file
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = https://github.com/nighthawkcoders/APCSA.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master