├── .freeCodeCamp ├── .bashrc └── test │ ├── .cwd │ └── .next_command ├── .gitignore ├── .gitpod.yml ├── .vscode └── settings.json ├── CHANGELOG.md ├── TUTORIAL.md ├── coderoad.yaml └── tutorial.json /.freeCodeCamp/.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc: executed by bash(1) for non-login shells. 2 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 3 | # for examples 4 | 5 | # If not running interactively, don't do anything 6 | case $- in 7 | *i*) ;; 8 | *) return;; 9 | esac 10 | 11 | # don't put duplicate lines or lines starting with space in the history. 12 | # See bash(1) for more options 13 | # I commented this out 14 | #HISTCONTROL=ignoreboth 15 | 16 | # append to the history file, don't overwrite it 17 | shopt -s histappend 18 | 19 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 20 | HISTSIZE=1000 21 | HISTFILESIZE=2000 22 | 23 | # check the window size after each command and, if necessary, 24 | # update the values of LINES and COLUMNS. 25 | shopt -s checkwinsize 26 | 27 | # If set, the pattern "**" used in a pathname expansion context will 28 | # match all files and zero or more directories and subdirectories. 29 | #shopt -s globstar 30 | 31 | # make less more friendly for non-text input files, see lesspipe(1) 32 | # I commented this out 33 | #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 34 | 35 | # set variable identifying the chroot you work in (used in the prompt below) 36 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 37 | debian_chroot=$(cat /etc/debian_chroot) 38 | fi 39 | 40 | # set a fancy prompt (non-color, unless we know we "want" color) 41 | case "$TERM" in 42 | xterm-color|*-256color) color_prompt=yes;; 43 | esac 44 | 45 | # uncomment for a colored prompt, if the terminal has the capability; turned 46 | # off by default to not distract the user: the focus in a terminal window 47 | # should be on the output of commands, not on the prompt 48 | #force_color_prompt=yes 49 | 50 | if [ -n "$force_color_prompt" ]; then 51 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 52 | # We have color support; assume it's compliant with Ecma-48 53 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 54 | # a case would tend to support setf rather than setaf.) 55 | color_prompt=yes 56 | else 57 | color_prompt= 58 | fi 59 | fi 60 | 61 | if [ "$color_prompt" = yes ]; then 62 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 63 | else 64 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 65 | fi 66 | unset color_prompt force_color_prompt 67 | 68 | # If this is an xterm set the title to user@host:dir 69 | case "$TERM" in 70 | xterm*|rxvt*) 71 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 72 | ;; 73 | *) 74 | ;; 75 | esac 76 | 77 | # enable color support of ls and also add handy aliases 78 | if [ -x /usr/bin/dircolors ]; then 79 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 80 | alias ls='ls --color=auto' 81 | #alias dir='dir --color=auto' 82 | #alias vdir='vdir --color=auto' 83 | 84 | # I commented these out 85 | # alias grep='grep --color=auto' 86 | # alias fgrep='fgrep --color=auto' 87 | # alias egrep='egrep --color=auto' 88 | fi 89 | 90 | # colored GCC warnings and errors 91 | #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 92 | 93 | # some more ls aliases - # I commented these out 94 | # alias ll='ls -alF' 95 | # alias la='ls -A' 96 | # alias l='ls -CF' 97 | 98 | # Add an "alert" alias for long running commands. Use like so: 99 | # sleep 10; alert 100 | # I commented this out 101 | #alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' 102 | 103 | # Alias definitions. 104 | # You may want to put all your additions into a separate file like 105 | # ~/.bash_aliases, instead of adding them here directly. 106 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 107 | 108 | if [ -f ~/.bash_aliases ]; then 109 | . ~/.bash_aliases 110 | fi 111 | 112 | # enable programmable completion features (you don't need to enable 113 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 114 | # sources /etc/bash.bashrc). 115 | if ! shopt -oq posix; then 116 | if [ -f /usr/share/bash-completion/bash_completion ]; then 117 | . /usr/share/bash-completion/bash_completion 118 | elif [ -f /etc/bash_completion ]; then 119 | . /etc/bash_completion 120 | fi 121 | fi 122 | 123 | # I commented this out 124 | #for i in $(ls -A $HOME/.bashrc.d/); do source $HOME/.bashrc.d/$i; done 125 | 126 | # Add RVM to PATH for scripting. Make sure this is the last PATH variable change. 127 | export PATH="$PATH:$HOME/.rvm/bin" 128 | 129 | # stuff I added 130 | PS1='camper: \[\033[01;34m\]/${PWD##*/}\[\033[00m\]\$ ' 131 | HISTFILE=/workspace/.bash_history 132 | PROMPT_COMMAND='echo $PWD >> /workspace/project/.freeCodeCamp/test/.cwd; history -a' 133 | trap 'echo $BASH_COMMAND >> /workspace/project/.freeCodeCamp/test/.next_command' DEBUG -------------------------------------------------------------------------------- /.freeCodeCamp/test/.cwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quillor243/learn-bash-scripting-by-building-five-programs/84988b9eb3c1f6ec24770309af32c32e6f4b25f8/.freeCodeCamp/test/.cwd -------------------------------------------------------------------------------- /.freeCodeCamp/test/.next_command: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quillor243/learn-bash-scripting-by-building-five-programs/84988b9eb3c1f6ec24770309af32c32e6f4b25f8/.freeCodeCamp/test/.next_command -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: gitpod/workspace-node-18:2024-01-24-09-19-42 2 | 3 | workspaceLocation: 'project' 4 | checkoutLocation: 'project' 5 | 6 | tasks: 7 | - before: | 8 | sudo touch /workspace/.bash_history 9 | sudo chmod -R 777 /workspace 10 | sudo cp /workspace/project/.freeCodeCamp/.bashrc ~/.bashrc 11 | 12 | command: | 13 | sudo rm /workspace/project/CHANGELOG.md 14 | sudo rm /workspace/project/coderoad.yaml 15 | sudo rm /workspace/project/tutorial.json 16 | sudo rm /workspace/project/TUTORIAL.md 17 | exit 18 | 19 | vscode: 20 | extensions: 21 | - CodeRoad.coderoad 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "breadcrumbs.enabled": false, 3 | "debug.internalConsoleOptions": "neverOpen", 4 | "debug.showInStatusBar": "never", 5 | "editor.acceptSuggestionOnCommitCharacter": false, 6 | "editor.acceptSuggestionOnEnter": "off", 7 | "editor.autoClosingBrackets": "never", 8 | "editor.codeActionsOnSave": { 9 | "source.fixAll": "explicit" 10 | }, 11 | "editor.hover.enabled": false, 12 | "editor.inlineSuggest.enabled": false, 13 | "editor.minimap.enabled": false, 14 | "editor.parameterHints.enabled": false, 15 | "editor.quickSuggestions": { 16 | "other": false, 17 | "comments": false, 18 | "strings": false 19 | }, 20 | "editor.referenceInfos": false, 21 | "editor.snippetSuggestions": "none", 22 | "editor.suggest.statusBar.visible": false, 23 | "editor.suggestOnTriggerCharacters": false, 24 | "editor.tabSize": 2, 25 | "explorer.autoReveal": false, 26 | "explorer.openEditors.visible": 0, 27 | "extensions.autoCheckUpdates": false, 28 | "extensions.ignoreRecommendations": true, 29 | "files.autoSave": "afterDelay", 30 | "files.exclude": { 31 | "**/.git": true, 32 | "**/.svn": true, 33 | "**/.hg": true, 34 | "**/CVS": true, 35 | "**/.DS_Store": true, 36 | ".vscode": true, 37 | ".gitignore": true, 38 | ".freeCodeCamp": true, 39 | "learn-bash-scripting-by-building-five-programs": true, 40 | ".gitpod.Dockerfile": true, 41 | ".gitpod.yml": true, 42 | "CHANGELOG.md": true, 43 | "coderoad.yaml": true, 44 | "tutorial.json": true, 45 | "TUTORIAL.md": true 46 | }, 47 | "html.autoClosingTags": false, 48 | "npm.fetchOnlinePackageInfo": false, 49 | "task.slowProviderWarning": false, 50 | "terminal.integrated.allowChords": false, 51 | "terminal.integrated.commandsToSkipShell": ["coderoad.enter"], 52 | "terminal.integrated.enableFileLinks": false, 53 | "terminal.integrated.environmentChangesIndicator": "off", 54 | "terminal.integrated.macOptionIsMeta": true, 55 | "terminal.integrated.showExitAlert": false, 56 | "telemetry.enableTelemetry": false, 57 | "update.mode": "none", 58 | "update.showReleaseNotes": false, 59 | "workbench.enableExperiments": false, 60 | "workbench.startupEditor": "none", 61 | "workbench.colorTheme": "Tomorrow Night Blue", 62 | "workbench.colorCustomizations": { 63 | "[Tomorrow Night Blue]": { 64 | "menu.background": "#0a0a23", 65 | "menu.foreground": "#ffffff", 66 | "activityBar.background": "#0a0a23", 67 | "activityBar.foreground": "#ffffff", 68 | "activityBar.activeBorder": "#ffffff", 69 | "activityBar.border": "#2a2a40", 70 | "editorWidget.background": "#0a0a23", 71 | "editorWidget.foreground": "#ffffff", 72 | "sideBar.background": "#1b1b32", 73 | "sideBarTitle.foreground": "#858591", 74 | "sideBar.foreground": "#f5f6f7", 75 | "sideBar.border": "#2a2a40", 76 | "editor.background": "#2a2a40", 77 | "editor.foreground": "#dfdfe2", 78 | "tab.activeForeground": "#ffffff", 79 | "tab.inactiveBackground": "#1b1b32", 80 | "tab.inactiveForeground": "#d0d0d5", 81 | "tab.border": "#2a2a40", 82 | "editorGroupHeader.tabsBackground": "#0a0a23", 83 | "editorIndentGuide.background": "#3b3b4f", 84 | "terminal.background": "#0a0a23", 85 | "terminal.foreground": "#ffffff", 86 | "terminal.ansiBrightGreen": "#ffffff", 87 | "panel.background": "#1b1b32", 88 | "panelTitle.inactiveForeground": "#858591", 89 | "panelTitle.activeBorder": "#f5f6f7" 90 | } 91 | }, 92 | "workbench.iconTheme": null, 93 | "workbench.statusBar.visible": false, 94 | "workbench.tips.enabled": false, 95 | "workbench.tree.renderIndentGuides": "none", 96 | "zenMode.centerLayout": false 97 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | Please read the guidelines in the [contributing docs](https://contribute.freecodecamp.org/#/how-to-work-on-tutorials-that-use-coderoad) before contributing. Contributions to this project need to follow the correct workflow. 4 | 5 | # Change Log 6 | 7 | Whenever a new version is created, add the new branch name and the changes here 8 | 9 | ## [v1.0.0] 10 | 11 | - Initial soft release with news article 12 | 13 | ## [v1.0.1] 14 | 15 | - Fix regex in steps `950.1` and `970.1`, to match variable in double parenthesis not preceded by `$` 16 | - Fix test description in step `990.1`: elif -> else 17 | 18 | ## [v1.0.2] 19 | 20 | - Move startup commands to `setup.sh` 21 | - Run `setup.sh` on continue and reset 22 | 23 | ## [v1.0.3] 24 | 25 | - Restructure commits to use new style. Instead of loading a new test file, and commenting out the old one on each commit, this loads all the tests in the `INIT` commit and uses mocha settings to only run tests in a specific file. The commits now just change the test file that should run. 26 | - There was an issue with the last commit not loading after using the reset button in a tutorial. I added a final commit at end that seems to have resolved it. 27 | - Add instructions for [issue](https://github.com/freeCodeCamp/freeCodeCamp/issues/45683) 28 | 29 | ## [v2.0.0] 30 | 31 | - Add Gitpod config 32 | -------------------------------------------------------------------------------- /TUTORIAL.md: -------------------------------------------------------------------------------- 1 | # Learn Bash Scripting by Building Five Programs 2 | 3 | > Welcome to the Bash Scripting lessons! 4 | 5 | ## 10. Start the Terminal 6 | 7 | ### 10.1 8 | 9 | **The first thing you need to do is start the terminal.** Do that by clicking the "hamburger" menu at the top left of the screen, going to the "terminal" section, and clicking "new terminal". Once you open a new one, type `echo hello bash` into the terminal and press enter. 10 | 11 | #### HINTS 12 | 13 | - Capitalization matters 14 | - If the tests don't run automatically, "trash" all the terminals and try the instructions again 15 | 16 | ## 20. touch questionnaire.sh 17 | 18 | ### 20.1 19 | 20 | You can run commands in the terminal or put them in a file to be run as a script. You will be making five small programs to learn some scripting. The first one will be a "questionnaire". Use the `touch` command to create `questionnaire.sh` in the `project` folder. 21 | 22 | #### HINTS 23 | 24 | - Type `touch questionnaire.sh` in the terminal and press enter 25 | - Make sure you are in the `project` folder first 26 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 27 | 28 | ## 30. Add echo questionnaire 29 | 30 | ### 30.1 31 | 32 | To start, open the file in the main editor by clicking the filename in the left side panel. 33 | Then, add the text `echo hello questionnaire` at the top of the file. 34 | 35 | #### HINTS 36 | 37 | - If the left side panel isn't visible, click the icon that looks like two pieces of paper 38 | at the top left to open the panel. Then, click on your file to open it 39 | - Add the suggested text to the `questionnaire.sh` file 40 | 41 | ## 35. sh questionnaire.sh 42 | 43 | ### 35.1 44 | 45 | Your script has one command. Run it with `sh questionnaire.sh` to see what happens. `sh` stands for `shell`. 46 | 47 | #### HINTS 48 | 49 | - Type `sh questionnaire.sh` in the terminal and press enter 50 | - Make sure you are in the `project` folder first 51 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 52 | 53 | ## 40. bash questionnaire.sh 54 | 55 | ### 40.1 56 | 57 | Using `sh` to run your script uses the `shell` interpreter. Run your script again with `bash questionnaire.sh` to use the `bash` interpreter. `bash` stands for `bourne-again shell`. 58 | 59 | #### HINTS 60 | 61 | - Type `bash questionnaire.sh` in the terminal and press enter 62 | - Make sure you are in the `project` folder first 63 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 64 | 65 | ## 50. which bash 66 | 67 | ### 50.1 68 | 69 | The output was the same. There are many interpreters which may not give the output you expect. Find out where the `bash` interpreter is located by entering `which bash` in the terminal. 70 | 71 | #### HINTS 72 | 73 | - Type `which bash` in the terminal and press enter 74 | 75 | ## 60. Add shebang 76 | 77 | ### 60.1 78 | 79 | That's the absolute path to the `bash` interpreter. You can tell your program to use it by placing a `shebang` at the very top of the file like this: `#!`. Add a `shebang` at the very top of your file, the one you want looks like this: `#!/bin/bash`. 80 | 81 | #### HINTS 82 | 83 | - Add `#!/bin/bash` at the top of your `questionnaire.sh` file 84 | 85 | ## 70. ./questionnaire 86 | 87 | ### 70.1 88 | 89 | Now, instead of using `sh` or `bash` to run your script. You can run it by executing the file and it will default to bash. Execute your script with `./questionnaire.sh`. You will get a permission denied error. 90 | 91 | #### HINTS 92 | 93 | - Type `./questionnaire.sh` in the terminal and press enter 94 | - Make sure you are in the `project` folder first 95 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 96 | 97 | ## 80. ls -l 98 | 99 | ### 80.1 100 | 101 | You should have got a permission denied message because you don't have permissions to execute the script. List what's in the `project` folder in long list format with `ls -l` to see the file permissions. 102 | 103 | #### HINTS 104 | 105 | - Type `ls -l` in the terminal and press enter 106 | - Make sure you are in the `project` folder first 107 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 108 | 109 | ## 90. chmod +x questionnaire.sh 110 | 111 | ### 90.1 112 | 113 | Next to your file is `-rw-r--r--`. All but the first character (`-`) describe permissions different users have with the file. `r` means `read`, `w` means `write`, `x` means `execute`. I don't see an `x` anywhere, so nobody can execute it. Enter `chmod +x questionnaire.sh` in the terminal to give everyone executable permissions. 114 | 115 | #### HINTS 116 | 117 | - Type `chmod +x questionnaire.sh` in the terminal and press enter 118 | - Make sure you are in the `project` folder first 119 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 120 | 121 | ## 100. ls -l 122 | 123 | ### 100.1 124 | 125 | List what's in the folder again with `ls -l` to see the new permissions. 126 | 127 | #### HINTS 128 | 129 | - Type `ls -l` in the terminal and press enter 130 | - Make sure you are in the `project` folder first 131 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 132 | 133 | ## 110. ./questionnaire 134 | 135 | ### 110.1 136 | 137 | The `x` was added by each type of user to denote that anyone can execute the file. Run your file again by executing it with `./questionnaire.sh`. 138 | 139 | #### HINTS 140 | 141 | - Type `./questionnaire.sh` in the terminal and press enter 142 | - Make sure you are in the `project` folder first 143 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 144 | 145 | ## 140. Add ls -l 146 | 147 | ### 140.1 148 | 149 | Now it works. In your script, you can add any commands that you would be able to enter in the terminal. Test this by adding the `ls -l` command below your other command. 150 | 151 | #### HINTS 152 | 153 | - Add `ls -l` at the bottom of your `questionnaire.sh` file 154 | 155 | ## 150. ./questionnaire 156 | 157 | ### 150.1 158 | 159 | Run the script by executing it again. 160 | 161 | #### HINTS 162 | 163 | - Type `./questionnaire.sh` in the terminal and press enter 164 | - Make sure you are in the `project` folder first 165 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 166 | 167 | ## 160. Delete all - shebang 168 | 169 | ### 160.1 170 | 171 | Your script printed the result of the two commands as if you entered them in the terminal. Delete everything but the `shebang` from your file so you can start making the questionnaire. 172 | 173 | #### HINTS 174 | 175 | - Only `#!/bin/bash` should remain in your `questionnaire.sh` file 176 | 177 | ## 170. Add QUESTION1 variable 178 | 179 | ### 170.1 180 | 181 | Bash has variables, functions, and other things you might be familiar with. You can create a variable with `VARIABLE_NAME=VALUE`. There cannot be any spaces around the equal (`=`) sign. If a variable has any spaces in it, place double quotes around it. Create a variable named `QUESTION1` and set it's value to `"What's your name?"`. 182 | 183 | #### HINTS 184 | 185 | - Add `QUESTION1="What's your name?"` at the bottom of your `questionnaire.sh` file 186 | 187 | ## 180. Add echo $QUESTION1 188 | 189 | ### 180.1 190 | 191 | To use a variable, place `$` in front of it like this: `$VARIABLE_NAME`. Shell scripts run from top to bottom, so you can only use variable below where it's created. Use `echo` to print your variable. 192 | 193 | #### HINTS 194 | 195 | - Add `echo $QUESTION1` at the bottom of your `questionnaire.sh` file 196 | 197 | ## 190. ./questionnaire 198 | 199 | ### 190.1 200 | 201 | Run the file like you did before to see if it worked. 202 | 203 | #### HINTS 204 | 205 | - Run your file by executing it 206 | - Type `./questionnaire.sh` in the terminal and press enter 207 | - Make sure you are in the `project` folder first 208 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 209 | 210 | ## 200. Add read NAME 211 | 212 | ### 200.1 213 | 214 | The question was printed. Next, you want to be able to accept input from a user. You can do that with `read` like this: `read VARIABLE_NAME`. This will get user input and store it into a new variable. After you print the question, use `read` to get input and store it in a variable named `NAME`. 215 | 216 | #### HINTS 217 | 218 | - Add `read NAME` at the bottom of your `questionnaire.sh` file 219 | 220 | ## 210. Add echo Hello $NAME 221 | 222 | ### 210.1 223 | 224 | At the bottom of your script, use `echo` to print `Hello .` to the terminal. 225 | 226 | #### HINTS 227 | 228 | - You can use your `NAME` variable like this: `$NAME` 229 | - Use your `$NAME` variable in place of `` 230 | - Don't forget the period 231 | - Add `echo Hello $NAME.` at the bottom of your script 232 | 233 | ## 220. ./questionnaire 234 | 235 | ### 220.1 236 | 237 | Run the file again. Type your name and press enter after it asks for it. 238 | 239 | #### HINTS 240 | 241 | - Run your file by executing it 242 | - Type `./questionnaire.sh` in the terminal and press enter 243 | - Make sure you are in the `project` folder first 244 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 245 | - You can press `ctrl+c` to close the program 246 | 247 | ## 230. Add QUESTION2 variable 248 | 249 | ### 230.1 250 | 251 | Right below your first variable, create another one named `QUESTION2`. Set the value to, `Where are you from?`. Make sure to put it in double quotes. 252 | 253 | #### HINTS 254 | 255 | - Here's an example: `VARIABLE="value"` 256 | - Add `QUESTION2="Where are you from?"` to your script 257 | 258 | ## 240. Add echo $QUESTION2 259 | 260 | ### 240.1 261 | 262 | After your `read` command, use your new variable to print the next question. 263 | 264 | #### HINTS 265 | 266 | - Use `echo` to print the variable 267 | - Add `echo $QUESTION2` below your `read` command 268 | 269 | ## 250. Add read LOCATION 270 | 271 | ### 250.1 272 | 273 | Below where the second question is printed, use `read` to get input from the user into a variable named `LOCATION`. 274 | 275 | #### HINTS 276 | 277 | - Here's an example `read VARIABLE_NAME` 278 | - Add `read LOCATION` to your script below `echo $QUESTION2` 279 | 280 | ## 260. Add echo Hello $NAME from $LOCATION 281 | 282 | ### 260.1 283 | 284 | Change the existing response to `Hello from .`. 285 | 286 | #### HINTS 287 | 288 | - Use your two variables in place of `` and ` ` 339 | - The command is `echo`, the flag is `--help` 340 | - Type `echo --help` in the terminal and press enter 341 | 342 | ## 310. man echo 343 | 344 | ### 310.1 345 | 346 | That didn't work as I hoped. Another way to find information about a command is with `man`. It stands for `manual` and you can use it like this: `man `. See if there's a manual for `echo`. 347 | 348 | #### HINTS 349 | 350 | - Type `man echo` in the terminal and press enter 351 | - Press enter until you have seen the whole menu 352 | 353 | ## 320. Add echo -e \n~~ Questionnaire ~~\n 354 | 355 | ### 320.1 356 | 357 | At the top of the menu, the `-e` option looks promising. And the `\n` below it says `new line`. You should take a look at those. In your script, change the title to `echo -e \n~~ Questionnaire ~~\n` to see if that prints the empty lines. 358 | 359 | #### HINTS 360 | 361 | - Change the suggested line to `echo -e \n~~ Questionnaire ~~\n` 362 | 363 | ## 323. ./questionnaire 364 | 365 | ### 323.1 366 | 367 | Run it to see if it worked. You can press `ctrl+c` to close the program after it starts if you don't want to enter values. 368 | 369 | #### HINTS 370 | 371 | - Run your file by executing it 372 | - Type `./questionnaire.sh` in the terminal and press enter 373 | - Make sure you are in the `project` folder first 374 | - You can press `ctrl+c` to close the program 375 | 376 | ## 326. Change to echo -e "\n~~ Questionnaire ~~\n" 377 | 378 | ### 326.1 379 | 380 | It didn't print the empty lines. `echo` will only print empty lines if the value is enclosed in quotes. Place double quotes around the title that gets printed to see if it works. 381 | 382 | #### HINTS 383 | 384 | - Change the suggested line to `echo -e "\n~~ Questionnaire ~~\n"` 385 | 386 | ## 330. ./questionnaire 387 | 388 | ### 330.1 389 | 390 | Run your script again to see if that fixed it. 391 | 392 | #### HINTS 393 | 394 | - Run your file by executing it 395 | - Type `./questionnaire.sh` in the terminal and press enter 396 | - Make sure you are in the `project` folder first 397 | - You can press `ctrl+c` to close the program 398 | 399 | ## 340. Add QUESTION3 variable 400 | 401 | ### 340.1 402 | 403 | Now it's working :smile: Create a `QUESTION3` variable next to the other two, set it's value to `"What's your favorite coding website?"` 404 | 405 | #### HINTS 406 | 407 | - Add `QUESTION3="What's your favorite coding website?"` to your `questionnaire.sh` file 408 | - Add it by the other two variables 409 | 410 | ## 345. echo QUESTION3 variable 411 | 412 | ### 345.1 413 | 414 | Use `echo` to print the third question after you `read` the `LOCATION`. 415 | 416 | #### HINTS 417 | 418 | - Add `echo $QUESTION3` below the `read LOCATION` 419 | - Add it to your `questionnaire.sh` file 420 | 421 | ## 350. read WEBSITE 422 | 423 | ### 350.1 424 | 425 | After the question you just printed, add code to read input into a variable named `WEBSITE`. 426 | 427 | #### HINTS 428 | 429 | - Add `read WEBSITE` below the `echo $QUESTION3` 430 | 431 | ## 360. echo final sentence 432 | 433 | ### 360.1 434 | 435 | Change the `echo` command of the response to print this sentence instead: `Hello from . I learned that your favorite coding website is !`. 436 | 437 | #### HINTS 438 | 439 | - Replace the `echo Hello $NAME from $LOCATION.` with the suggested sentence 440 | - Use your three variables in place of ``, ``, and `` 441 | - The command should look like this: `echo Hello $NAME from $LOCATION. I learned that your favorite coding website is $WEBSITE!` 442 | 443 | ## 363. ./questionnaire 444 | 445 | ### 363.1 446 | 447 | Run the script and enter values when the program is waiting. Let's see the final output. 448 | 449 | #### HINTS 450 | 451 | - Run your file by executing it 452 | - Type `./questionnaire.sh` in the terminal and press enter 453 | - Make sure you are in the `project` folder first 454 | 455 | ## 366. Add line breaks around final sentence 456 | 457 | ### 366.1 458 | 459 | One last thing. Change that final response to print an empty line at the beginning of the sentence. 460 | 461 | #### HINTS 462 | 463 | - Use `echo` with the `-e` flag and a new line (`\n`) character like you did for the title 464 | - Don't forget to put the response in double quotes so it prints the empty line 465 | - Here's an example: `echo -e "\n"` 466 | - Only add a new line at the beginning of the response, not the end 467 | - The final command should look like this: `echo "\nHello $NAME from $LOCATION. I learned that your favorite coding website is $WEBSITE!"` 468 | 469 | ## 370. ./questionnaire 470 | 471 | ### 370.1 472 | 473 | Run it one last time and enter values when it asks to see if you like how it looks. 474 | 475 | #### HINTS 476 | 477 | - Run your file by executing it 478 | - Type `./questionnaire.sh` in the terminal and press enter 479 | - Make sure you are in the `project` folder first 480 | 481 | ## 380. touch countdown.sh 482 | 483 | ### 380.1 484 | 485 | It looks good. I think you are done with that script for now. The next program will be countdown timer. Use the `touch` command to create a new file named `countdown.sh` in your `project` folder. 486 | 487 | #### HINTS 488 | 489 | - Type `touch countdown.sh` in the terminal and press enter 490 | - Make sure you are in the `project` folder first 491 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 492 | 493 | ## 390. chmod +x countdown.sh 494 | 495 | ### 390.1 496 | 497 | Give your file executable permissions so you can run it like the other one. It's the `chmod` command with the `+x` flag. 498 | 499 | #### HINTS 500 | 501 | - Here's an example `chmod ` 502 | - The value for permissions you want to use is `+x` 503 | - You previously used `chmod +x questionnaire.sh` 504 | - Type `chmod +x countdown.sh` in the terminal and press enter 505 | - Make sure you are in the `project` folder first 506 | 507 | ## 400. Add shebang 508 | 509 | ### 400.1 510 | 511 | You want to use the `bash` interpreter again. Add a `shebang` at the top of your new file to denote that. 512 | 513 | #### HINTS 514 | 515 | - A `shebang` looks like this: `#!` 516 | - Enter `which bash` in the terminal to see the path to `bash` 517 | - Look at the `shebang` in your first script to get the syntax 518 | - It should look like this: `#!/bin/bash` 519 | - Add `#!/bin/bash` at the top of your `countdown.sh` file 520 | 521 | ## 410. Add comment 522 | 523 | ### 410.1 524 | 525 | Comments in `bash` look like this: `# `. Add a comment below the `shebang` that says `Program that counts down to zero from a given argument` so people know what it does. Note that the `shebang` is a special case and is not treated like a comment. 526 | 527 | #### HINTS 528 | 529 | - Add `# Program that counts down to zero from a given argument` to your `countdown.sh` file 530 | 531 | ## 420. Add echo $* 532 | 533 | ### 420.1 534 | 535 | Programs can take arguments. You can access them a few different ways with `$`. Add `echo $*` in your script to print all arguments passed to it. 536 | 537 | #### HINTS 538 | 539 | - Add `echo $*` at the bottom of the `countdown.sh` file 540 | 541 | ## 425. ./countdown.sh 542 | 543 | ### 425.1 544 | 545 | Execute your script with `./countdown.sh`. 546 | 547 | #### HINTS 548 | 549 | - Type `./countdown.sh` in the terminal and press enter 550 | - Make sure you are in the `project` folder first 551 | 552 | ## 430. ./countdown.sh arg1 arg2 arg3 553 | 554 | ### 430.1 555 | 556 | Nothing was printed. Run your script again, but this time add three arguments to the command; `arg1`, `arg2`, and `arg3`. Place them after the command with a space before each one. 557 | 558 | #### HINTS 559 | 560 | - Type `./countdown.sh arg1 arg2 arg3` in the terminal and press enter 561 | - Make sure you are in the `project` folder first 562 | 563 | ## 440. Change to echo $1 564 | 565 | ### 440.1 566 | 567 | `$*` printed all the arguments passed to your script. To access any one of them, use `$`. `arg2` could have been accessed with `$2`. Change your script to `echo` the first argument instead of all the arguments. 568 | 569 | #### HINTS 570 | 571 | - Try running your script with an argument to make sure it’s giving the expected output 572 | - Use `echo $1` to print the second argument 573 | - Change `echo $*` to `echo $1` in your `countdown.sh` file 574 | 575 | ## 450. ./countdown.sh arg1 arg2 arg3 576 | 577 | ### 450.1 578 | 579 | Run your file with `./countdown.sh arg1 arg2 arg3` again. 580 | 581 | #### HINTS 582 | 583 | - Type `./countdown.sh arg1 arg2 arg3` in the terminal and press enter 584 | - Make sure you are in the `project` folder first 585 | 586 | ## 460. help 587 | 588 | ### 460.1 589 | 590 | Now it just prints the first argument. Your program will accept an argument to count down from. You will test it with an `if` statement to make sure it's a positive integer. I wonder what that syntax would look like. Type `help` in the terminal to see if you can find anything. 591 | 592 | #### HINTS 593 | 594 | - Type `help` in the terminal and press enter 595 | 596 | ## 470. man if 597 | 598 | ### 470.1 599 | 600 | This is a list of built-in commands. You should look over it, some of them may look familiar. I see `echo` in there. Another one is `if`. See if you can find out more about it by checking its `man` page. 601 | 602 | #### HINTS 603 | 604 | - Here's an example: `man ` 605 | - Type `man if` in the terminal and press enter 606 | 607 | ## 480. help if 608 | 609 | ### 480.1 610 | 611 | I guess there isn't a `man` page for it. At the top of the `help` screen, I noticed you can use `help ` to find out more. Yet another way to find out about a command :disappointed_relieved: See if you can find out more about `if` with that method. 612 | 613 | #### HINTS 614 | 615 | - Here's an example `help ` 616 | - Type `help if` in the terminal and press enter 617 | 618 | ## 490. Add if arg1 print true 619 | 620 | ### 490.1 621 | 622 | The syntax is at the top, not all of it is required. Here's another example: 623 | 624 | ```sh 625 | if [[ CONDITION ]] 626 | then 627 | STATEMENTS 628 | fi 629 | ``` 630 | 631 | Remove the `echo $1` in your script and add an `if` condition that checks `if [[ $1 == arg1 ]]`. In its `then` area, use `echo` to print `true` to the screen. There must be spaces on the inside of the brackets (`[[ ... ]]`) and around the operator (`==`). 632 | 633 | #### HINTS 634 | 635 | - Make sure to remove the `echo $1` 636 | - Add the following to your `countdown.sh` file: 637 | ```sh 638 | if [[ $1 == arg1 ]] 639 | then 640 | echo true 641 | fi 642 | ``` 643 | 644 | ## 500. ./countdown arg1 645 | 646 | ### 500.1 647 | 648 | Notice that the end of the syntax is `fi` (`if` backwards). It should print `true` if you pass `arg1` to your script now. Run the script with `arg1` as the only argument. 649 | 650 | #### HINTS 651 | 652 | - Type `./countdown.sh arg1` in the terminal and press enter 653 | - Make sure you are in the `project` folder first 654 | 655 | ## 505. ./countdown !arg1 656 | 657 | ### 505.1 658 | 659 | The `if` condition worked, it printed `true`. Run it again with anything except `arg1` as the first argument. 660 | 661 | #### HINTS 662 | 663 | - Type `./countdown.sh arg2` in the terminal and press enter 664 | - Make sure you are in the `project` folder first 665 | 666 | ## 510. Add else print false 667 | 668 | ### 510.1 669 | 670 | Nothing was printed. One of the optional parts of `if` was an `else` area. You can use it like this: 671 | 672 | ```sh 673 | if [[ CONDITION ]] 674 | then 675 | STATEMENTS 676 | else 677 | STATEMENTS 678 | fi 679 | ``` 680 | 681 | Add an `else` to your existing `if` condition. Use `echo` to print `false` if the condition fails. 682 | 683 | #### HINTS 684 | 685 | - Your `if` should look like this: 686 | ```sh 687 | if [[ $1 == arg1 ]] 688 | then 689 | echo true 690 | else 691 | echo false 692 | fi 693 | ``` 694 | 695 | ## 520. ./countdown !arg1 696 | 697 | ### 520.1 698 | 699 | Run the script again and use anything except `arg1` as the only argument. 700 | 701 | #### HINTS 702 | 703 | - Type `./countdown.sh !arg1` in the terminal and press enter 704 | - Make sure you are in the `project` folder first 705 | - Enter `cd ~/project` in the terminal to get to the project folder if you aren't there 706 | 707 | ## 530. Change if condition -lt 5 708 | 709 | ### 530.1 710 | 711 | Now it printed `false`. Your program is expecting an integer to count down from as its argument. You can compare integers inside the brackets (`[[ ... ]]`) of your `if` with `-eq` (equal), `-ne` (not equal), `-lt` (less than), `-le` (less than or equal), `-gt` (greater than), `-ge` (greater than or equal). Change your `if` condition to check if your first argument is less than `5`. 712 | 713 | #### HINTS 714 | 715 | - Make sure there's spaces inside the brackets (`[[ ... ]]`) and around the operator (`-lt`) 716 | - Your `if` condition should look like this: `[[ $1 -lt 5 ]]` 717 | - The whole `if` should look like this: 718 | ```sh 719 | if [[ $1 -lt 5 ]] 720 | then 721 | echo true 722 | else 723 | echo false 724 | fi 725 | ``` 726 | 727 | ## 540. ./countdown 4 728 | 729 | ### 540.1 730 | 731 | Run the script again and use `4` as a first argument to make sure it's working. 732 | 733 | #### HINTS 734 | 735 | - Type `./countdown.sh 4` in the terminal and press enter 736 | - Make sure you are in the `project` folder first 737 | 738 | ## 542. ./countdown 5 739 | 740 | ### 542.1 741 | 742 | It printed `true` since your argument was less than `5`. Run it again with `5` as the argument. 743 | 744 | #### HINTS 745 | 746 | - Type `./countdown.sh 5` in the terminal and press enter 747 | - Make sure you are in the `project` folder first 748 | 749 | ## 544. help 750 | 751 | ### 544.1 752 | 753 | As expected, that printed `false`. Take a look at that `help` menu again. I want to see if we can find out more about how these expressions work. 754 | 755 | #### HINTS 756 | 757 | - Type `help` in the terminal and press enter 758 | 759 | ## 546. help [[ expression ]] 760 | 761 | ### 546.1 762 | 763 | Near the top left, it says `[[ expression ]]`. Those look like the double brackets you are using. See if you can get more info about that with the `help` command like you did with `help if`. 764 | 765 | #### HINTS 766 | 767 | - Here's an example: `help ` 768 | - Type `help [[ expression ]]` or `help [[` in the terminal and press enter 769 | 770 | ## 548. help test 771 | 772 | ### 548.1 773 | 774 | It might not be a bad idea to read that. Looks like you can use some, probably familiar, things like `!`, `&&`, and `||` to compare multiple expressions. There's also `==` and `!=` operators for an individual expression. It says something about the `test` built-in command. See if you can bring up the `help` menu for that. 775 | 776 | #### HINTS 777 | 778 | - View the `help` menu of the suggested command like you did for the `help if` 779 | - Here's an example: `help ` 780 | - Type `help test` in the terminal and press enter 781 | 782 | ## 550. Change if to [[ $1 -le 5 ]] 783 | 784 | ### 550.1 785 | 786 | That's what I was looking for. At the top are some file operators. There's some string and other operators as well. You should take a look at them. Near the bottom, are the arithmetic operators you used with your `if` condition. Change the condition in your script to check if the first argument is less than or equal to `5`. 787 | 788 | #### HINTS 789 | 790 | - The `if` condition should look like this: `[[ $1 -le 5 ]]` 791 | - Make sure there's spaces inside the brackets (`[[ ... ]]`) and around the operator (`-le`) 792 | - It's the `if` in your `countdown.sh` file 793 | 794 | ## 552. ./countdown 5 795 | 796 | ### 552.1 797 | 798 | Run the script and use `5` as a first argument again. 799 | 800 | #### HINTS 801 | 802 | - Type `./countdown.sh 5` in the terminal and press enter 803 | - Make sure you are in the `project` folder first 804 | 805 | ## 554. [[ 4 -le 5 ]] 806 | 807 | ### 554.1 808 | 809 | Now it prints `true`. Remember I said any command can run in the terminal or a script. Try running an expression right in the terminal by entering `[[ 4 -le 5 ]]` in it. 810 | 811 | #### HINTS 812 | 813 | - Enter the suggested expression in the terminal 814 | - Make sure there's spaces inside the brackets (`[[ ... ]]`) and around the operator (`-le`) 815 | - Type `[[ 4 -le 5 ]]` in the terminal and press enter 816 | 817 | ## 556. echo $? 818 | 819 | ### 556.1 820 | 821 | Nothing happened? Each command has an exit status that can be accessed with `$?`. View the exit status of the **last command** with `echo $?`. 822 | 823 | #### HINTS 824 | 825 | - Type `echo $?` in the terminal and press enter 826 | - Your second to last command should be `[[ 4 -le 5 ]]`. So enter that before `echo $?` 827 | 828 | ## 558. [[ 4 -ge 5 ]] 829 | 830 | ### 558.1 831 | 832 | The exit status of `0` means it was true, `4` is indeed less or equal to `5`. Try it again with `[[ 4 -ge 5 ]]`. 833 | 834 | #### HINTS 835 | 836 | - Enter the suggested expression in the terminal 837 | - Make sure there's spaces inside the brackets (`[[ ... ]]`) and around the operator (`-ge`) 838 | - Type `[[ 4 -ge 5 ]]` in the terminal and press enter 839 | 840 | ## 560. echo $? 841 | 842 | ### 560.1 843 | 844 | Use `echo` to view the exit status of the command you just entered. 845 | 846 | #### HINTS 847 | 848 | - Type `echo $?` in the terminal and press enter 849 | - Your second to last command should be `[[ 4 -ge 5 ]]`. So enter that right before `echo $?` 850 | 851 | ## 562. [[ 4 -ge 5 ]]; echo $? 852 | 853 | ### 562.1 854 | 855 | It printed `1` this time for false. You can separate commands on a single line with `;`. Enter your last two commands on one line like this: `[[ 4 -ge 5 ]]; echo $?`. It will run the expression, then print the exit status of it since it was the last command. 856 | 857 | #### HINTS 858 | 859 | - Make sure there's spaces inside the brackets (`[[ ... ]]`) and around the operator (`-ge`) 860 | - Type `[[ 4 -ge 5 ]]; echo $?` in the terminal and press enter 861 | 862 | ## 564. [[ 10 -ne 5 ]]; echo $? 863 | 864 | ### 564.1 865 | 866 | It's still false. Using the same syntax of `[[ ... ]]; echo $?`, check if `10` is not equal to `5` and print the exit status of the expression on one line. 867 | 868 | #### HINTS 869 | 870 | - Check the `help test` menu to find the `not equal` operator 871 | - It's the `-ne` operator 872 | - You previously used `[[ 4 -ge 5 ]]; echo $?` 873 | - Make sure there's spaces inside the brackets and around the operator 874 | - Type `[[ 10 -ne 5 ]]; echo $?` in the terminal and press enter 875 | 876 | ## 566. bad_command; echo $? 877 | 878 | ### 566.1 879 | 880 | You can think of an exit status of `0` as true. But it means that the command had zero errors. All commands have an exit status. Using the same syntax, enter `bad_command;` and check its exit status on a single line. 881 | 882 | #### HINTS 883 | 884 | - The syntax looks like this: `; echo $?` 885 | - You previously used `[[ 10 -ne 5 ]]; echo $?` 886 | - Type `bad_command; echo $?` in the terminal and press enter 887 | 888 | ## 568. ls; echo $? 889 | 890 | ### 568.1 891 | 892 | `command not found`, with an exit status of `127`. Anything but `0` means there was an error with the command. `bad_command` didn't exist. Try it again with `ls`. 893 | 894 | #### HINTS 895 | 896 | - Use the same syntax you have been using 897 | - Here's an example `; echo $?` 898 | - You previously used `bad_command; echo $?` 899 | - Type `ls; echo $?` in the terminal and press enter 900 | 901 | ## 570. ls -y; echo $? 902 | 903 | ### 570.1 904 | 905 | The command executed as expected and there were zero errors. So it gave you an exit status of `0`. Try it again with `ls -y`. 906 | 907 | #### HINTS 908 | 909 | - Use the same syntax you have been using 910 | - Here's an example: `; echo $?` 911 | - You previously used `ls; echo $?` 912 | - Type `ls -y; echo $?` in the terminal and press enter 913 | 914 | ## 572. help test 915 | 916 | ### 572.1 917 | 918 | The `-y` flag doesn't work with `ls` so it gave you an exit status other than `0`, meaning that the command was unsuccessful. View the `help` menu of the `test` command again, I want to see what else is in that list. 919 | 920 | #### HINTS 921 | 922 | - Here's an example: `help ` 923 | - Type `help test` in the terminal and press enter 924 | 925 | ## 574. [[ -a countdown.sh ]]; echo $? 926 | 927 | ### 574.1 928 | 929 | You tried a few of the arithmetic operators, those work for integers. Try one of the file operators. The first one on the list checks if a file exists. Type `[[ -a countdown.sh ]]; echo $?` in the terminal to see if your file exists. 930 | 931 | #### HINTS 932 | 933 | - Enter the suggested commands in the terminal 934 | - Type `[[ -a countdown.sh ]]; echo $?` in the terminal and press enter 935 | - Don't forget the spaces inside the brackets 936 | - Make sure you are in the `project` folder first 937 | 938 | ## 575. [[ -a bad_file.txt ]]; echo $? 939 | 940 | ### 575.1 941 | 942 | The file must exist. It's checking the folder the command is entered from. Try it again with `bad_file.txt`. 943 | 944 | #### HINTS 945 | 946 | - Use the same syntax you have been using 947 | - Here's an example: `; echo $?` 948 | - You previously used `[[ -a countdown.sh ]]; echo $?` 949 | - Type `[[ -a bad_file.txt ]]; echo $?` in the terminal and press enter 950 | - Don't forget the spaces inside the brackets 951 | 952 | ## 576. [[ -x countdown.sh ]]; echo $? 953 | 954 | ### 576.1 955 | 956 | `bad_file.txt` doesn't exist. I think you're getting the hang of this. Using the same syntax, check if you have permissions to execute your `countdown.sh` file. You may want to look at that menu again. 957 | 958 | #### HINTS 959 | 960 | - View the `help test` menu to find the file operator for checking if a file is executable by you 961 | - It's the `-x` operator 962 | - The syntax you want is `[[ ... ]]; echo $?` to see if the condition is true 963 | - Don't forget the spaces inside the brackets 964 | - Type `[[ -x countdown.sh ]]; echo $?` in the terminal and press enter 965 | - Make sure you are in the `project` folder first 966 | 967 | ## 582. help [[ expression ]] 968 | 969 | ### 582.1 970 | 971 | You played around with a number of the expressions. View the `help [[ expression ]]` menu again that you looked at before to see a few more options. You can view the menu with just `help [[`. 972 | 973 | #### HINTS 974 | 975 | - Enter the suggested command in the terminal 976 | - Type `help [[ expression ]]` or `help [[` in the terminal and press enter 977 | 978 | ## 584. [[ -x countdown.sh && 5 -le 4 ]]; echo $? 979 | 980 | ### 584.1 981 | 982 | As I mentioned before, you can test multiple expressions with `&&` and `||`. Enter `[[ -x countdown.sh && 5 -le 4 ]]; echo $?` in the terminal to test the file is executable by you **and** five is less than or equal to four. 983 | 984 | #### HINTS 985 | 986 | - Enter the suggested command in the terminal 987 | - Type `[[ -x countdown.sh && 5 -le 4 ]]; echo $?` in the terminal and press enter 988 | - Make sure there's spaces around the brackets and all the operators 989 | 990 | ## 586. [[ -x countdown.sh || 5 -le 4 ]]; echo $? 991 | 992 | ### 586.1 993 | 994 | Both conditions weren't true, so the exit status was `1` for `false`. Try testing the same two conditions with the `or` operator. 995 | 996 | #### HINTS 997 | 998 | - Modify this `[[ -x countdown.sh && 5 -le 4 ]]; echo $?` with the suggestion and enter it in the terminal 999 | - Use the `or` operator from the `help [[ expression ]]` menu 1000 | - The `or` operator is `||` 1001 | - Type `[[ -x countdown.sh || 5 -le 4 ]]; echo $?` in the terminal and press enter 1002 | - Make sure there's spaces around the brackets and all the operators 1003 | 1004 | ## 588. Change if to [[ $1 -gt 0 ]] 1005 | 1006 | ### 588.1 1007 | 1008 | One of the conditions was true so it printed `0`. I think that's enough of a detour. Back in your script, change the `if` condition to check if the first argument is **greater than zero** so you can be sure it's something you can count down from. 1009 | 1010 | #### HINTS 1011 | 1012 | - Use the `-gt` operator in your `if` condition 1013 | - The `if` condition should look like this: `[[ $1 -gt 0 ]]` 1014 | - It's in the `countdown.sh` file 1015 | 1016 | ## 590. Change if !# message 1017 | 1018 | ### 590.1 1019 | 1020 | The condition you added checks if a positive integer was passed as an argument to the script and executes the `then` area. Change the existing `echo` command to print `Include a positive integer as the first argument.` if a positive integer is not used. 1021 | 1022 | #### HINTS 1023 | 1024 | - The `else` area should look like this: `echo Include a positive integer as the first argument.` 1025 | - The whole `if` condition should look like this: 1026 | ```sh 1027 | if [[ $1 -gt 0 ]] 1028 | then 1029 | echo true 1030 | else 1031 | echo Include a positive integer as the first argument. 1032 | fi 1033 | ``` 1034 | 1035 | ## 600. ./countdown 1 1036 | 1037 | ### 600.1 1038 | 1039 | Run your script and use `1` as a first argument to make sure the condition is working. 1040 | 1041 | #### HINTS 1042 | 1043 | - Type `./countdown.sh 1` in the terminal and press enter 1044 | - Make sure you are in the `project` folder first 1045 | 1046 | ## 610. ./countdown 0 1047 | 1048 | ### 610.1 1049 | 1050 | Run it again and use anything but a positive integer as the only argument. 1051 | 1052 | #### HINTS 1053 | 1054 | - Type `./countdown.sh 0` in the terminal and press enter 1055 | - Make sure you are in the `project` folder first 1056 | 1057 | ## 615. help 1058 | 1059 | ### 615.1 1060 | 1061 | Looks like your `if` condition is working. Next, you want to loop over the argument and count down to zero from it. Check the `help` menu to see if there's any commands for this. 1062 | 1063 | #### HINTS 1064 | 1065 | - Enter the suggested command in the terminal 1066 | - Type `help` in the terminal and press enter 1067 | 1068 | ## 620. Add for loop for countdown 1069 | 1070 | ### 620.1 1071 | 1072 | There's two `for` loops in there, you want the second one. Here's an example: 1073 | 1074 | ```sh 1075 | for (( i = 10; i > 0; i-- )) 1076 | do 1077 | echo $i 1078 | done 1079 | ``` 1080 | 1081 | The above creates a variable (`i = 10`), then prints it, subtracts one, and repeats until `i` is not greater than `0`. So it prints `10` through `1`. In the `then` area of your condition, replace the `echo` with a `for` loop that prints from the argument (`$1`) to `1`. 1082 | 1083 | #### HINTS 1084 | 1085 | - Set the variable to the value of your argument (`$1`) initially 1086 | - Use the same syntax as the example except change the `10` to `$1` 1087 | - Don't include any extra commands in the `then` area 1088 | - Your `then` area should look like this: 1089 | ```sh 1090 | for (( i = $1; i > 0; i-- )) 1091 | do 1092 | echo $i 1093 | done 1094 | ``` 1095 | - The whole `if` condition should look like this: 1096 | ```sh 1097 | if [[ $1 -gt 0 ]] 1098 | then 1099 | for (( i = $1; i > 0; i-- )) 1100 | do 1101 | echo $i 1102 | done 1103 | else 1104 | echo Include a positive integer as the first argument. 1105 | fi 1106 | ``` 1107 | 1108 | ## 630. ./countdown 10 1109 | 1110 | ### 630.1 1111 | 1112 | Run your script and use `10` as the first argument. 1113 | 1114 | #### HINTS 1115 | 1116 | - Type `./countdown.sh 10` in the terminal and press enter 1117 | - Make sure you are in the `project` folder first 1118 | 1119 | ## 640. help 1120 | 1121 | ### 640.1 1122 | 1123 | It works :smile: But I want it to pause for one second between each number. Check the `help` menu again to see if there's any commands that might help. 1124 | 1125 | #### HINTS 1126 | 1127 | - Enter the suggested command in the terminal 1128 | - Type `help` in the terminal and press enter 1129 | 1130 | ## 650. ls / 1131 | 1132 | ### 650.1 1133 | 1134 | I'm not seeing the command I was hoping to. These are the built-in commands, where are the rest? Type `ls /` to look around. 1135 | 1136 | #### HINTS 1137 | 1138 | - Enter the suggested command in the terminal 1139 | - Type `ls /` in the terminal and press enter 1140 | 1141 | ## 660. ls /bin 1142 | 1143 | ### 660.1 1144 | 1145 | The `/` listed what's in the root of the file system. I see a `bin` folder, `bin` stands for `binary`. View what's in it with `ls /bin`. 1146 | 1147 | #### HINTS 1148 | 1149 | - Enter the suggested command in the terminal 1150 | - Type `ls /bin` in the terminal and press enter 1151 | 1152 | ## 670. man sleep 1153 | 1154 | ### 670.1 1155 | 1156 | These are some non built-in commands. There's quite a few that should look familiar. One is `bash`, that's the one you used for the `shebang` in your scripts. I see one called `sleep`. View the manual of it. 1157 | 1158 | #### HINTS 1159 | 1160 | - View a manual with the `man` command 1161 | - Here's an example: `man ` 1162 | - Enter `man sleep` in the terminal 1163 | - Press enter until you have seen the whole menu 1164 | 1165 | ## 675. sleep 3 1166 | 1167 | ### 675.1 1168 | 1169 | At the top, it says you can pause execution for a number of seconds. Try it out by entering `sleep 3` in the terminal. 1170 | 1171 | #### HINTS 1172 | 1173 | - Enter the suggested command in the terminal 1174 | - Enter `sleep 3` in the terminal 1175 | 1176 | ## 680. Add sleep to for loop 1177 | 1178 | ### 680.1 1179 | 1180 | That should work. In your `for` loop, use `sleep` to make the script pause for `1` second after each number is printed. 1181 | 1182 | #### HINTS 1183 | 1184 | - Add the suggestion to the `for` loop in your `countdown.sh` file 1185 | - Add `sleep 1` after you print `i` in your `for` loop 1186 | 1187 | ## 690. ./countdown 3 1188 | 1189 | ### 690.1 1190 | 1191 | Run your script and use `3` as the first argument. 1192 | 1193 | #### HINTS 1194 | 1195 | - Type `./countdown.sh 3` in the terminal and press enter 1196 | - Make sure you are in the `project` folder first 1197 | 1198 | ## 692. Change to >= 1199 | 1200 | ### 692.1 1201 | 1202 | Awesome. Except it should print `0` instead of stopping at `1`. Change the condition in your for loop so that it checks for `i >= 0`. 1203 | 1204 | #### HINTS 1205 | 1206 | - Your `for` loop should look like this: 1207 | ```sh 1208 | for (( i = $1; i >= 0; i-- )) 1209 | do 1210 | echo $i 1211 | sleep 1 1212 | done 1213 | ``` 1214 | - The whole `if` condition should look like this: 1215 | ```sh 1216 | if [[ $1 -gt 0 ]] 1217 | then 1218 | for (( i = $1; i >= 0; i-- )) 1219 | do 1220 | echo $i 1221 | sleep 1 1222 | done 1223 | else 1224 | echo Include a positive integer as the first argument. 1225 | fi 1226 | ``` 1227 | 1228 | ## 694. ./countdown 3 1229 | 1230 | ### 694.1 1231 | 1232 | Run your script with `3` as the argument again. 1233 | 1234 | #### HINTS 1235 | 1236 | - Type `./countdown.sh 3` in the terminal and press enter 1237 | - Make sure you are in the `project` folder first 1238 | 1239 | ## 696. Add echo -e "title" 1240 | 1241 | ### 696.1 1242 | 1243 | Excellent. I want it to display a title like the other script. Make it so that it prints `~~ Countdown Timer ~~` before anything else. Include a new line before and after it like you did for the other title. 1244 | 1245 | #### HINTS 1246 | 1247 | - Use the `echo` command with the `-e` flag and the new line (`\n`) character 1248 | - Make sure to place the message in double quotes 1249 | - Here's an example: `echo -e "\n\n"` 1250 | - Add `echo -e "\n~~ Countdown Timer ~~\n"` to the `countdown.sh` file after the comment 1251 | 1252 | ## 698. ./countdown 1 1253 | 1254 | ### 698.1 1255 | 1256 | Run your script and use `1` as the first argument again to see the title. 1257 | 1258 | #### HINTS 1259 | 1260 | - Type `./countdown.sh 1` in the terminal and press enter 1261 | - Make sure you are in the `project` folder first 1262 | 1263 | ## 700. Add Multiline comment 1264 | 1265 | ### 700.1 1266 | 1267 | This is fun. You can create a multiline comment like this: 1268 | 1269 | ```sh 1270 | : ' 1271 | comment here 1272 | more comment here 1273 | ' 1274 | ``` 1275 | 1276 | Comment out your `for` loop with a multiline comment. I want to try and do this with a `while` loop. 1277 | 1278 | #### HINTS 1279 | 1280 | - Comment out the `for` loop in your `countdown.sh` file with a multiline comment 1281 | - Make sure there's a space between the `:` and `'` 1282 | - Your `for` loop should look like this: 1283 | ```sh 1284 | : ' 1285 | for (( i = $1; i >= 0; i-- )) 1286 | do 1287 | echo $i 1288 | sleep 1 1289 | done 1290 | ' 1291 | ``` 1292 | 1293 | ## 710. help while 1294 | 1295 | ### 710.1 1296 | 1297 | View the `help` menu for the `while` command to see if you can find anything. 1298 | 1299 | #### HINTS 1300 | 1301 | - Here's an example: `help ` 1302 | - Enter `help while` in the terminal 1303 | 1304 | ## 730. Add I variable 1305 | 1306 | ### 730.1 1307 | 1308 | It shows the syntax. First, below your comment, create a variable named `I` that is set to the value of your first argument. It will start there, then on each iteration of the `while` loop you can subtract `1` from it until it reaches `0`. 1309 | 1310 | #### HINTS 1311 | 1312 | - Add `I=$1` in the `then` area of your `if` statements below the multi-line comment 1313 | - The `then` area should look like this: 1314 | ```sh 1315 | : ' 1316 | for (( i = $1; i >= 0; i-- )) 1317 | do 1318 | echo $i 1319 | sleep 1 1320 | done 1321 | ' 1322 | I=$1 1323 | ``` 1324 | 1325 | ## 740. Add while loop 1326 | 1327 | ### 740.1 1328 | 1329 | The menu showed that you can make a `while` loop like this: 1330 | 1331 | ```sh 1332 | while [[ CONDITION ]] 1333 | do 1334 | STATEMENTS 1335 | done 1336 | ``` 1337 | 1338 | Add a `while` loop below the `I` variable you made. The condition should be `$I -ge 0` and you should `echo` the `I` variable in the `do` statements. 1339 | 1340 | #### HINTS 1341 | 1342 | - Your `while` loop should look like this: 1343 | ```sh 1344 | while [[ $I -ge 0 ]] 1345 | do 1346 | echo $I 1347 | done 1348 | ``` 1349 | 1350 | ## 750. Add (( I-- )) 1351 | 1352 | ### 750.1 1353 | 1354 | `I` never changes here, so you would have an infinite loop. You can subtract one from `I` with double parenthesis (`((...))`) and the `--` operator. In your while loop, add `(( I-- ))` after you `echo $I` to subtract one from `I` on each pass. 1355 | 1356 | #### HINTS 1357 | 1358 | - Your `while` loop should look like this: 1359 | ```sh 1360 | while [[ $I -ge 0 ]] 1361 | do 1362 | echo $I 1363 | (( I-- )) 1364 | done 1365 | ``` 1366 | 1367 | ## 760. Add sleep 1 1368 | 1369 | ### 760.1 1370 | 1371 | The last thing to do is to add the `sleep` again. In your `while` loop, add the code to make it `sleep` for `1` second. Add the code after the `(( I-- ))`. 1372 | 1373 | #### HINTS 1374 | 1375 | - Use the same `sleep 1` you used in the `for` loop 1376 | - Your `while` loop should look like this: 1377 | ```sh 1378 | while [[ $I -ge 0 ]] 1379 | do 1380 | echo $I 1381 | (( I-- )) 1382 | sleep 1 1383 | done 1384 | ``` 1385 | 1386 | ## 770. ./countdown.sh 5 1387 | 1388 | ### 770.1 1389 | 1390 | Run the script and use 5 as the first argument. 1391 | 1392 | #### HINTS 1393 | 1394 | - Type `./countdown.sh 5` in the terminal and press enter 1395 | - Make sure you are in the `project` folder first 1396 | 1397 | ## 780. touch bingo.sh 1398 | 1399 | ### 780.1 1400 | 1401 | I think the countdown timer is finished. Feel free to try it with some other arguments. The next one is a bingo number generator. Use `touch` to create `bingo.sh` in the same folder as the others. 1402 | 1403 | #### HINTS 1404 | 1405 | - Type `touch bingo.sh` in the terminal and press enter 1406 | - Make sure you are in the `project` folder first 1407 | 1408 | ## 790. chmod +x bingo.sh 1409 | 1410 | ### 790.1 1411 | 1412 | Give your file executable permissions like you did for the other two. 1413 | 1414 | #### HINTS 1415 | 1416 | - Use the `chmod` command with the `+x` flag 1417 | - Here's an example `chmod ` 1418 | - You previously used `chmod +x countdown.sh` 1419 | - Type `chmod +x bingo.sh` in the terminal and press enter 1420 | 1421 | ## 800. Add shebang 1422 | 1423 | ### 800.1 1424 | 1425 | Add a `shebang` at the top of your new script. It should use `bash` again like other two. 1426 | 1427 | #### HINTS 1428 | 1429 | - A `shebang` looks like this: `#!` 1430 | - Enter `which bash` in the terminal to see the path to `bash` 1431 | - Look at the `shebang` in one of your other scripts to get the syntax 1432 | - It should look like this: `#!/bin/bash` 1433 | - Add `#!/bin/bash` at the top of your `bingo.sh` file 1434 | 1435 | ## 810. Add comment 1436 | 1437 | ### 810.1 1438 | 1439 | Add a comment below the `shebang` that says, `Bingo Number Generator`. 1440 | 1441 | #### HINTS 1442 | 1443 | - Comments look like this: `# ` 1444 | - Add `#Bingo Number Generator` below the `shebang` 1445 | - Capitalization matters 1446 | 1447 | ## 815. Add echo -e "title" 1448 | 1449 | ### 815.1 1450 | 1451 | Before I forget, use a single `echo` command to print a title for this program. It should say `~~ Bingo Number Generator ~~` with an empty line before and after it. 1452 | 1453 | #### HINTS 1454 | 1455 | - Use the `echo` command with the `-e` flag and the new line (`\n`) character 1456 | - Don't forget the double quotes when using a new line character 1457 | - Take a look at one of the title's from a previous file for a hint 1458 | - Here's an example: `echo -e "\n\n"` 1459 | - You previously used `echo -e "\n~~ Countdown Timer ~~\n"` 1460 | - Add `echo -e "\n~~ Bingo Number Generator ~~\n"` below the comment of your `bingo.sh` file 1461 | 1462 | ## 817. Add NUMBER=5 variable 1463 | 1464 | ### 817.1 1465 | 1466 | In your script, create a `NUMBER` variable that equals `5`. 1467 | 1468 | #### HINTS 1469 | 1470 | - Here's an example: `VARIABLE_NAME=VALUE` 1471 | - Add `NUMBER=5` to the bottom of your `bingo.sh` file 1472 | 1473 | ## 818. echo $NUMBER 1474 | 1475 | ### 818.1 1476 | 1477 | Below your new variable, use `echo` to print it to the screen. 1478 | 1479 | #### HINTS 1480 | 1481 | - Here's an example: `echo $` 1482 | - Use `NUMBER` in place of `` 1483 | - Add `echo $NUMBER` at the bottom of your `bingo.sh` file 1484 | 1485 | ## 819. ./bingo.sh 1486 | 1487 | ### 819.1 1488 | 1489 | Run the script by executing it. 1490 | 1491 | #### HINTS 1492 | 1493 | - Type `./bingo.sh` in the terminal and press enter 1494 | - Make sure you are in the `project` folder first 1495 | 1496 | ## 820. printenv 1497 | 1498 | ### 820.1 1499 | 1500 | The numbers in bingo go up to 75, each number has a letter from the word `bingo` associated with it. You will need to randomly generate a number between 1 and 75. Bash may have something that can help you here. A shell comes with environment variables. View them by entering `printenv` in the terminal. 1501 | 1502 | #### HINTS 1503 | 1504 | - Type `printenv` in the terminal and press enter 1505 | 1506 | ## 822. echo $LANG 1507 | 1508 | ### 822.1 1509 | 1510 | These are all environment variables, they are predefined and loaded with each shell. Most of them aren’t very relevant, but it’s nice to know they’re there. One of them is `LANG`. Use `echo` to print it in the terminal. 1511 | 1512 | #### HINTS 1513 | 1514 | - Here's an example: `echo $` 1515 | - Type `echo $LANG` in the terminal and press enter 1516 | 1517 | ## 824. declare -p 1518 | 1519 | ### 824.1 1520 | 1521 | View all variables in the shell with `declare -p`. `-p` stands for `print` 1522 | 1523 | #### HINTS 1524 | 1525 | - Type `declare -p` in the terminal and press enter 1526 | 1527 | ## 826. echo $RANDOM 1528 | 1529 | ### 826.1 1530 | 1531 | This list includes all the environment variables, and any others that may have been created in the current shell. There's one named `RANDOM`. Use `echo` to print it in the terminal. 1532 | 1533 | #### HINTS 1534 | 1535 | - Here's an example: `echo $` 1536 | - Type `echo $RANDOM` in the terminal and press enter 1537 | 1538 | ## 828. Change to NUMBER=$RANDOM 1539 | 1540 | ### 828.1 1541 | 1542 | Back in your script, use the `RANDOM` variable to set `NUMBER` to a random number instead of `5`. 1543 | 1544 | #### HINTS 1545 | 1546 | - Change `NUMBER=5` to `NUMBER=$RANDOM` 1547 | 1548 | ## 830. ./bingo.sh 1549 | 1550 | ### 830.1 1551 | 1552 | Run the script a few times in a row to make sure it's working. 1553 | 1554 | #### HINTS 1555 | 1556 | - Type `./bingo.sh` in the terminal and press enter two times in a row 1557 | - Make sure you are in the `project` folder first 1558 | 1559 | ## 835. Change to NUMBER=$RANDOM%75 1560 | 1561 | ### 835.1 1562 | 1563 | The `RANDOM` variable will generate a random number between 0 and 32767. You can use the `modulus` operator to make it in the range you want. In your script, change the `NUMBER` variable to `$RANDOM%75`. 1564 | 1565 | #### HINTS 1566 | 1567 | - Change `NUMBER=$RANDOM` to `NUMBER=$RANDOM%75` 1568 | 1569 | ## 840. ./bingo.sh 1570 | 1571 | ### 840.1 1572 | 1573 | Run the script again. 1574 | 1575 | #### HINTS 1576 | 1577 | - Type `./bingo.sh` in the terminal and press enter 1578 | - Make sure you are in the `project` folder first 1579 | 1580 | ## 881. I=0 1581 | 1582 | ### 881.1 1583 | 1584 | Bash sees everything as a string so it just printed the `%75` part literally. In the terminal, create an `I` variable equal to `0` (zero), so you can play with it and figure out how to do some calculations. 1585 | 1586 | #### HINTS 1587 | 1588 | - Type `I=0` in the terminal and press enter 1589 | 1590 | ## 884. echo $I 1591 | 1592 | ### 884.1 1593 | 1594 | In the terminal, use `echo` to print your new variable. 1595 | 1596 | #### HINTS 1597 | 1598 | - Here's an example: `echo $` 1599 | - Type `echo $I` in the terminal and press enter 1600 | 1601 | ## 887. (( I++ )) 1602 | 1603 | ### 887.1 1604 | 1605 | I noticed that you used double parenthesis in the `while` loop of your countdown timer to subtract one from `I`. Type `(( I++ ))` in the terminal to see if anything happens. 1606 | 1607 | #### HINTS 1608 | 1609 | - Type `(( I++ ))` in the terminal and press enter 1610 | 1611 | ## 890. echo $I 1612 | 1613 | ### 890.1 1614 | 1615 | There was no output. Use `echo` to print `I` in the terminal again. 1616 | 1617 | #### HINTS 1618 | 1619 | - Type `echo $I` in the terminal and press enter 1620 | 1621 | ## 891. help let 1622 | 1623 | ### 891.1 1624 | 1625 | The double parenthesis performed the calculation, changing the value of `I` from `0` to `1`. Enter `help let` in the terminal to see the operators you can use with the double parenthesis. 1626 | 1627 | #### HINTS 1628 | 1629 | - Type `help let` in the terminal and press enter 1630 | 1631 | ## 893. (( I += 10 )) 1632 | 1633 | ### 893.1 1634 | 1635 | You used several of these now, including in the `for` loop from the countdown timer. Enter `(( I += 10 ))` in the terminal to increment `I` by `10`. Note that you don't need to prepend variables with `$` inside these parenthesis. 1636 | 1637 | #### HINTS 1638 | 1639 | - Type `(( I += 10 ))` in the terminal and press enter 1640 | 1641 | ## 896. echo $I 1642 | 1643 | ### 896.1 1644 | 1645 | Use `echo` to print your `I` variable again. 1646 | 1647 | #### HINTS 1648 | 1649 | - Type `echo $I` in the terminal and press enter. 1650 | 1651 | ## 897. $(( I + 4 )) 1652 | 1653 | ### 897.1 1654 | 1655 | It should have printed `11` for the value of `I`. Using the double parenthesis like you have been is good for changing variable values or making comparisons. It makes the calculation in place and provides no output. If you want to make a calculation and do something with the result, add a `$` in front like this: `$(( ... ))`. Type `$(( I + 4 ))` in the terminal to see what happens. 1656 | 1657 | #### HINTS 1658 | 1659 | - If it didn't print `11` for `I`, enter `I=11` to set it to `11` 1660 | - Type `$(( I + 4 ))` in the terminal and press enter 1661 | 1662 | ## 899. echo $(( I + 4 )) 1663 | 1664 | ### 899.1 1665 | 1666 | It should say, `bash: 15: command not found`. It replaced the command with the result of the calculation. Effectively, trying to run `15` as a command. Enter the same command, but put `echo` in front of it. The command was `$(( I + 4 ))` 1667 | 1668 | #### HINTS 1669 | 1670 | - Type `echo $(( I + 4 ))` in the terminal and press enter 1671 | 1672 | ## 902. echo $I 1673 | 1674 | ### 902.1 1675 | 1676 | Again, it replaced the calculation with the result. So it was basically the same as if you entered `echo 15`. Use `echo` to print `I` to the screen again. 1677 | 1678 | #### HINTS 1679 | 1680 | - Type `echo $I` in the terminal and press enter 1681 | 1682 | ## 905. J=$(( I - 6 )) 1683 | 1684 | ### 905.1 1685 | 1686 | It should still have printed `11` for `I`. See the hints if it didn't. These double parenthesis with a `$` are how you can assign a variable to some calculation. In the terminal, create a `J` variable, and use the `$(( ... ))` syntax to set its value to `I - 6`. 1687 | 1688 | #### HINTS 1689 | 1690 | - If it didn't print `11` for `I`, enter `I=11` to set it to `11` 1691 | - Type `J=$(( I - 6 ))` in the terminal and press enter 1692 | 1693 | ## 908. echo $J 1694 | 1695 | ### 908.1 1696 | 1697 | Use `echo` to print `J`. 1698 | 1699 | #### HINTS 1700 | 1701 | - Here's an example: `echo $` 1702 | - Type `echo $J` in the terminal and press enter 1703 | 1704 | ## 911. echo $(( J * 5 + 25 )) 1705 | 1706 | ### 911.1 1707 | 1708 | `J` should equal `5`. For some more practice, use `echo` to print the value `J * 5 + 25`. 1709 | 1710 | #### HINTS 1711 | 1712 | - Type `echo $(( J * 5 + 25 ))` in the terminal and press enter 1713 | 1714 | ## 912. echo $J 1715 | 1716 | ### 912.1 1717 | 1718 | It should have printed `50`. Print `J` with `echo` again. 1719 | 1720 | #### HINTS 1721 | 1722 | - Here's an example: `echo $` 1723 | - Type `echo $J` in the terminal and press enter 1724 | 1725 | ## 913. declare -p 1726 | 1727 | ### 913.1 1728 | 1729 | So, as a reminder, `(( ... ))` will perform a calculation or operation and output nothing. `$(( ... ))` will replace the calculation with the result of it. You made a few variables in this shell, view them with `declare -p`. 1730 | 1731 | #### HINTS 1732 | 1733 | - Type `declare -p` in the terminal and press enter 1734 | 1735 | ## 914. declare -p J 1736 | 1737 | ### 914.1 1738 | 1739 | `declare` can be used to create variables, but you are just going to use it to view them for now. If you scroll up a little, you should find your `I` and `J` variables in there. View `J` with `declare -p J`. 1740 | 1741 | #### HINTS 1742 | 1743 | - Type `declare -p J` in the terminal and press enter 1744 | 1745 | ## 916. declare -p RANDOM 1746 | 1747 | ### 916.1 1748 | 1749 | I saw `RANDOM` in that list, too. View it with `declare -p ` like you did for `J`. 1750 | 1751 | #### HINTS 1752 | 1753 | - Type `declare -p RANDOM` in the terminal and press enter 1754 | 1755 | ## 918. echo $(( RANDOM % 75 )) 1756 | 1757 | ### 918.1 1758 | 1759 | Okay, I think I finally know how to get the random number for the Bingo Number Generator. Use `echo` and `RANDOM % 75` to print a random number in the terminal. 1760 | 1761 | #### HINTS 1762 | 1763 | - Use the `$(( ... ))` syntax to calculate the random number 1764 | - Here's an example: `echo $(( ))` 1765 | - Type `echo $(( RANDOM % 75 ))` in the terminal and press enter 1766 | 1767 | ## 920. echo $(( RANDOM % 75 + 1 )) 1768 | 1769 | ### 920.1 1770 | 1771 | One tiny problem, that calculation will give a number between 0 and 74. Enter the same command in the terminal, but add `1` to the calculation to get a random number between 1 and 75. 1772 | 1773 | #### HINTS 1774 | 1775 | - Type `echo $(( RANDOM % 75 + 1 ))` in the terminal and press enter 1776 | 1777 | ## 928. Set NUMBER=$(( RANDOM % 75 + 1)) 1778 | 1779 | ### 928.1 1780 | 1781 | Back in your `bingo.sh` script, change the `NUMBER` variable so that it starts as a random number between 1 and 75 using the syntax you have been practicing. 1782 | 1783 | #### HINTS 1784 | 1785 | - Change the `NUMBER` variable to the result of the calculation `RANDOM % 75 + 1` 1786 | - Use the `$(( ... ))` syntax to make the calculation 1787 | - It should look like this: `NUMBER=$(( RANDOM % 75 + 1 ))` 1788 | 1789 | ## 930. run ./bingo.sh 1790 | 1791 | ### 930.1 1792 | 1793 | Run your script a few times in a row to make sure it's working. 1794 | 1795 | #### HINTS 1796 | 1797 | - Type `./bingo.sh` in the terminal and press enter 1798 | - Make sure you are in the `project` folder first 1799 | - Run it at least two times in a row 1800 | 1801 | ## 940. Add TEXT variable 1802 | 1803 | ### 940.1 1804 | 1805 | Next, create a `TEXT` variable and set the value to `"The next number is, "`. When the script is finished, the output will be something like `The next number is B:15`. 1806 | 1807 | #### HINTS 1808 | 1809 | - Make sure there's a space after the comma 1810 | - Add `TEXT="The next number is, "` to the `bingo.sh` file 1811 | 1812 | ## 945. help let 1813 | 1814 | ### 945.1 1815 | 1816 | The letter that goes with the random number depends on what the number is. If it's 15 or less, it will be a `B`. I saw some comparisons in the `help let` menu, take a look at it again. 1817 | 1818 | #### HINTS 1819 | 1820 | - Type `help let` in the terminal and press enter 1821 | 1822 | ## 950. Add first if <= 15 1823 | 1824 | ### 950.1 1825 | 1826 | You used the double square brackets with your `if` statement in the last program, but you can use the double parenthesis with these operators as well. In your script, create an `if` statement that uses double parenthesis for the condition. Check if the number variable is less than or equal to 15. If it is, use your two variables to print `The next number is, B:`. 1827 | 1828 | #### HINTS 1829 | 1830 | - Make sure you only have two `echo` statements in your script, the title being one of them 1831 | - Here's an example of how your `if` statement should look: 1832 | ```sh 1833 | if (( CONDITION )) 1834 | then 1835 | STATEMENTS 1836 | fi 1837 | ``` 1838 | - The condition you want is `(( NUMBER <= 15 ))` 1839 | - In the statements area, use `echo` and your two variables to print `The next number is, B:` 1840 | - The statements area should look like this: `echo $TEXT B:$NUMBER` 1841 | - The whole `if` statement should look like this: 1842 | ```sh 1843 | if (( NUMBER <= 15 )) 1844 | then 1845 | echo $TEXT B:$NUMBER 1846 | fi 1847 | ``` 1848 | 1849 | ## 960. Add elif -le 30 1850 | 1851 | ### 960.1 1852 | 1853 | `if` statements can have an "else if" area like this: 1854 | ```sh 1855 | if (( CONDITION )) 1856 | then 1857 | STATEMENTS 1858 | elif [[ CONDITION ]] 1859 | then 1860 | STATEMENTS 1861 | fi 1862 | ``` 1863 | 1864 | Using the double square brackets this time, add an `elif` condition that checks if the number variable is less than or equal to `30`. If it is, use your two variables again to print `The next number is, I:` 1865 | 1866 | #### HINTS 1867 | 1868 | - View the `help test` menu to see the operators you can use with the double square brackets 1869 | - The condition you want is `[[ $NUMBER -le 30 ]]`. Don't forget the `$` 1870 | - In the statements area, use `echo` and your two variables to print `The next number is, I:` 1871 | - The statements area should look like this: `echo $TEXT I:$NUMBER` 1872 | - The `elif` area should look like this: 1873 | ```sh 1874 | elif [[ $NUMBER -le 30 ]] 1875 | then 1876 | echo $TEXT I:$NUMBER 1877 | fi 1878 | ``` 1879 | - The whole `if` statement should look like this: 1880 | ```sh 1881 | if (( NUMBER <= 15 )) 1882 | then 1883 | echo $TEXT B:$NUMBER 1884 | elif [[ $NUMBER -le 30 ]] 1885 | then 1886 | echo $TEXT I:$NUMBER 1887 | fi 1888 | ``` 1889 | 1890 | ## 970. Add elif < 46 1891 | 1892 | ### 970.1 1893 | 1894 | You can add as many `elif` sections to an `if` statement as you want. Add another `elif`, below the last, one that uses the double parenthesis to check if the number variable is less than 46. If it is, use your two variables to print `The next number is, N:` 1895 | 1896 | #### HINTS 1897 | 1898 | - View the `help let` menu to see the operators you can use with the double parenthesis 1899 | - The operator you want it `<` 1900 | - You can add another `elif` like this: 1901 | ```sh 1902 | if CONDITION 1903 | then 1904 | STATEMENTS 1905 | elif CONDITION 1906 | then 1907 | STATEMENTS 1908 | elif CONDITION 1909 | then 1910 | STATEMENTS 1911 | fi 1912 | ``` 1913 | - The condition you want is `(( NUMBER < 46 ))` 1914 | - In the statements area, use `echo` and your two variables to print `The next number is, N:` 1915 | - The statements area should look like this: `echo $TEXT N:$NUMBER` 1916 | - This `elif` area should look like this: 1917 | ```sh 1918 | elif (( NUMBER < 46 )) 1919 | then 1920 | echo $TEXT N:$NUMBER 1921 | fi 1922 | ``` 1923 | - The whole `if` statement should look like this: 1924 | ```sh 1925 | if (( NUMBER <= 15 )) 1926 | then 1927 | echo $TEXT B:$NUMBER 1928 | elif [[ $NUMBER -le 30 ]] 1929 | then 1930 | echo $TEXT I:$NUMBER 1931 | elif (( NUMBER < 46 )) 1932 | then 1933 | echo $TEXT N:$NUMBER 1934 | fi 1935 | ``` 1936 | 1937 | ## 980. Add elif -lt 61 1938 | 1939 | ### 980.1 1940 | 1941 | Run your script if you want to see the output. It should print one of the sentences if the random number is less than 46. It may take a couple tries. Add another `elif`, below the last one, that uses double square brackets to check if the number variable is less than 61. If it is, use your two variables to print `The next number is, G:` 1942 | 1943 | #### HINTS 1944 | 1945 | - View the `help test` menu to see the operators you can use with the double square brackets 1946 | - The operator you want it `-lt` 1947 | - The condition you want is `[[ $NUMBER -lt 61 ]]`. Don't forget the `$` 1948 | - The statements area should look like this: `echo $TEXT G:$NUMBER` 1949 | - This `elif` area should look like this: 1950 | ```sh 1951 | elif [[ $NUMBER -lt 61 ]] 1952 | then 1953 | echo $TEXT G:$NUMBER 1954 | fi 1955 | ``` 1956 | - The whole `if` statement should look like this: 1957 | ```sh 1958 | if (( NUMBER <= 15 )) 1959 | then 1960 | echo $TEXT B:$NUMBER 1961 | elif [[ $NUMBER -le 30 ]] 1962 | then 1963 | echo $TEXT I:$NUMBER 1964 | elif (( NUMBER < 46 )) 1965 | then 1966 | echo $TEXT N:$NUMBER 1967 | elif [[ $NUMBER -lt 61 ]] 1968 | then 1969 | echo $TEXT G:$NUMBER 1970 | fi 1971 | ``` 1972 | 1973 | ## 990. Add else 1974 | 1975 | ### 990.1 1976 | 1977 | One more case to handle. Add an `else` at the bottom of the `if` that uses your two variables to print `The next number is, O:`. 1978 | 1979 | #### HINTS 1980 | 1981 | - View the `if/else` in your `countdown.sh` file to see how you did it before 1982 | - You don't need a condition or the `then` on this one 1983 | - Here's an example: 1984 | ```sh 1985 | if CONDITION 1986 | then 1987 | STATEMENTS 1988 | elif CONDITION 1989 | then 1990 | STATEMENTS 1991 | ... 1992 | else 1993 | STATEMENTS 1994 | fi 1995 | ``` 1996 | - The `else` area should look like this: 1997 | ```sh 1998 | else 1999 | echo $TEXT O:$NUMBER 2000 | ``` 2001 | - The whole `if` should look like this: 2002 | ```sh 2003 | if (( NUMBER <= 15 )) 2004 | then 2005 | echo $TEXT B:$NUMBER 2006 | elif [[ $NUMBER -le 30 ]] 2007 | then 2008 | echo $TEXT I:$NUMBER 2009 | elif (( NUMBER < 46 )) 2010 | then 2011 | echo $TEXT N:$NUMBER 2012 | elif [[ $NUMBER -lt 61 ]] 2013 | then 2014 | echo $TEXT G:$NUMBER 2015 | else 2016 | echo $TEXT O:$NUMBER 2017 | fi 2018 | ``` 2019 | 2020 | ## 1000. ./bingo.sh 2021 | 2022 | ### 1000.1 2023 | 2024 | Run your script a few times and make sure it's working. 2025 | 2026 | #### HINTS 2027 | 2028 | - Type `./bingo.sh` in the terminal and press enter 2029 | - Make sure you are in the `project` folder first 2030 | - Run it at least two times in a row 2031 | 2032 | ## 1010. touch fortune.sh 2033 | 2034 | ### 1010.1 2035 | 2036 | I think the generator is done :smile: The next project is a fortune teller. Use the `touch` command to create `fortune.sh` in the same folder as the other scripts. 2037 | 2038 | #### HINTS 2039 | 2040 | - Type `touch fortune.sh` in the terminal and press enter 2041 | - Make sure you are in the `project` folder first 2042 | 2043 | ## 1020. chmod +x fortune.sh 2044 | 2045 | ### 1020.1 2046 | 2047 | Give your file executable permissions. 2048 | 2049 | #### HINTS 2050 | 2051 | - Use the `chmod` command with the `+x` flag 2052 | - Here's an example `chmod ` 2053 | - You previously used `chmod +x bingo.sh` 2054 | - Type `chmod +x fortune.sh` in the terminal and press enter 2055 | 2056 | ## 1030. Add shebang 2057 | 2058 | ### 1030.1 2059 | 2060 | Add a `shebang` at the top of your new file that uses `bash` again. 2061 | 2062 | #### HINTS 2063 | 2064 | - A `shebang` looks like this: `#!` 2065 | - Enter `which bash` in the terminal to see the path to `bash` 2066 | - Look at the `shebang` in one of your other scripts to get the syntax 2067 | - It should look like this: `#!/bin/bash` 2068 | - Add `#!/bin/bash` at the top of your `fortune.sh` file 2069 | 2070 | ## 1040. Add comment 2071 | 2072 | ### 1040.1 2073 | 2074 | Add comment `Program to tell a persons fortune` 2075 | 2076 | #### HINTS 2077 | 2078 | - Comments look like this: `# ` 2079 | - Add `#Program to tell a persons fortune` below the `shebang` 2080 | - Capitalization matters 2081 | 2082 | ## 1050. Add echo "title" 2083 | 2084 | ### 1050.1 2085 | 2086 | Add a title for this one like the others. This one should say `~~ Fortune Teller ~~`. Don't forget the empty line before and after it. 2087 | 2088 | #### HINTS 2089 | 2090 | - Print the whole title and the empty lines with a single `echo` command 2091 | - Use the `echo` command with the `-e` flag and the new line (`\n`) character 2092 | - Don't forget to put it in double quotes 2093 | - Take a look at one of the title's from a previous file for a hint 2094 | - Here's an example: `echo -e "\n\n"` 2095 | - You previously used `echo -e "\n~~ Bingo Number Generator ~~\n"` 2096 | - Add `echo -e "\n~~ Fortune Teller ~~\n"` below the comment of your `fortune.sh` file 2097 | 2098 | ## 1060. ./fortune.sh 2099 | 2100 | ### 1060.1 2101 | 2102 | Run the file once to make sure it's working. 2103 | 2104 | #### HINTS 2105 | 2106 | - Type `./fortune.sh` in the terminal and press enter 2107 | - Make sure you are in the `project` folder first 2108 | 2109 | ## 1070. ARR=("a" "b" "c") 2110 | 2111 | ### 1070.1 2112 | 2113 | This program will have an array of responses. One will be printed randomly after a user inputs a question. Practice first :smile: In the terminal, create an array like this: `ARR=("a" "b" "c")` 2114 | 2115 | #### HINTS 2116 | 2117 | - Type the suggested command in the terminal 2118 | - Type `ARR=("a" "b" "c")` in the terminal and press enter 2119 | 2120 | ## 1080. echo ${ARR[1]} 2121 | 2122 | ### 1080.1 2123 | 2124 | Each variable in the array is like any other variable, just combined into a single variable. In the terminal, print the second item in the array with `echo ${ARR[1]}`. Note that the first item would be index zero. 2125 | 2126 | #### HINTS 2127 | 2128 | - Type `echo ${ARR[1]}` in the terminal 2129 | 2130 | ## 1090. echo ${ARR[@]} 2131 | 2132 | ### 1090.1 2133 | 2134 | If you recall, you were able to print all the arguments to your `countdown.sh` script with `echo $*`. `echo $@` would have worked as well. Similarly, you can use the `*` or `@` to print your whole array. In the terminal, use `echo` to print all the items in your array. 2135 | 2136 | #### HINTS 2137 | 2138 | - Here's an example `echo ${ARR[]}` 2139 | - Type `echo ${ARR[@]}` in the terminal and press enter 2140 | 2141 | ## 1100. declare -p ARR 2142 | 2143 | ### 1100.1 2144 | 2145 | The variable must be in that `declare` list. View your array variable using the `declare` command and the `-p` flag. 2146 | 2147 | #### HINTS 2148 | 2149 | - Here's an example: `declare -p ` 2150 | - Type `declare -p ARR` in the terminal 2151 | 2152 | ## 1110. Add RESPONSES array 2153 | 2154 | ### 1110.1 2155 | 2156 | The `-a` next to it stands for `array`. In your script, create an array named `RESPONSES`. Give it these six values: `Yes`, `No`, `Maybe`, `Outlook good`, `Don't count on it`, and `Ask again later`. 2157 | 2158 | #### HINTS 2159 | 2160 | - Here's an example: `VARIABLE=(value value ...)` 2161 | - Make sure any values with spaces are in proper quotes 2162 | - You created your other array with `ARR=("a" "b" "c")` 2163 | - Add `RESPONSES=("Yes" "No" "Maybe" "Outlook good" "Don't count on it" "Ask again later")` in your script 2164 | 2165 | ## 1120. echo ${RESPONSES[5]} 2166 | 2167 | ### 1120.1 2168 | 2169 | In your script, use `echo` to print the last item in the array. 2170 | 2171 | #### HINTS 2172 | 2173 | - Here's an example `echo ${ARR[]}` 2174 | - Remember that the first item starts at zero 2175 | - Add `echo ${RESPONSES[5]}` to your `fortune.sh` file 2176 | 2177 | ## 1130. ./fortune.sh 2178 | 2179 | ### 1130.1 2180 | 2181 | Run it to see the output. 2182 | 2183 | #### HINTS 2184 | 2185 | - Type `./fortune.sh` in the terminal and press enter 2186 | - Make sure you are in the `project` folder first 2187 | 2188 | ## 1140. Add N=$(( RANDOM % 6 )) 2189 | 2190 | ### 1140.1 2191 | 2192 | You will randomly print one of the values. In your script, create a variable named `N`. Set it equal to a random number between `0` and `5`, the first and last index of the array. 2193 | 2194 | #### HINTS 2195 | 2196 | - Use the modulus (`%`) operator and `6` to get a number between `0` and `5` 2197 | - Look at the random number you created in the `bingo.sh` file for a hint 2198 | - Here's an example: `VARIABLE=$(( ))` 2199 | - Calculate a random number in the range you want with `RANDOM % 6` 2200 | - Add `N=$(( RANDOM % 6 ))` to the script 2201 | 2202 | ## 1150. Change to echo ${RESPONSES[$N]} 2203 | 2204 | ### 1150.1 2205 | 2206 | Change your `echo` command to print the item in the array whose index is the random number you generated. 2207 | 2208 | #### HINTS 2209 | 2210 | - Use your `$N` variable as the index where you print an item from the array 2211 | - Don't forget that scripts run from top to bottom, so you can't use any variables before they are created 2212 | - Change the `echo` line to `echo ${RESPONSES[$N]}` 2213 | 2214 | ## 1160. help 2215 | 2216 | ### 1160.1 2217 | 2218 | You will create a function to generate an answer. Check the `help` menu to see if you can find anything. 2219 | 2220 | #### HINTS 2221 | 2222 | - Enter the suggested command in the terminal 2223 | - Type `help` in the terminal 2224 | 2225 | ## 1170. help function 2226 | 2227 | ### 1170.1 2228 | 2229 | See any that might help? There's one that says `function`. See if you can find out more about it. 2230 | 2231 | #### HINTS 2232 | 2233 | - Use the `help` command to find out more 2234 | - Here's an example: `help ` 2235 | - Type `help function` in the terminal 2236 | 2237 | ## 1180. Add GET_FORTUNE function 2238 | 2239 | ### 1180.1 2240 | 2241 | It looks like you can create a function like this: 2242 | 2243 | ```sh 2244 | FUNCTION_NAME() { 2245 | STATEMENTS 2246 | } 2247 | ``` 2248 | 2249 | Add an empty function named `GET_FORTUNE` to your script. Make sure the response you are printing is the last thing in the script. 2250 | 2251 | #### HINTS 2252 | 2253 | - Add this to your script: 2254 | ```sh 2255 | GET_FORTUNE() {} 2256 | ``` 2257 | - Your `echo ${RESPONSES[$N]}` command should be at the bottom of the file 2258 | 2259 | ## 1190. Add echo Ask a yes or no question 2260 | 2261 | ### 1190.1 2262 | 2263 | In your function, use `echo` to print `Ask a yes or no question:` 2264 | 2265 | #### HINTS 2266 | 2267 | - Your function should look like this: 2268 | ```sh 2269 | GET_FORTUNE() { 2270 | echo Ask a yes or no question: 2271 | } 2272 | ``` 2273 | - Your `echo ${RESPONSES[$N]}` command should be at the bottom of the file 2274 | 2275 | ## 1200. Add GET_FORTUNE function call 2276 | 2277 | ### 1200.1 2278 | 2279 | Call your function by putting the name of it below where you create it. No `$` needed. Make sure the response you are printing is at the bottom of the file. 2280 | 2281 | #### HINTS 2282 | 2283 | - Add `GET_FORTUNE` below where you create your function to call it 2284 | - Your `echo ${RESPONSES[$N]}` command should be at the bottom of the file 2285 | 2286 | ## 1210. ./fortune.sh 2287 | 2288 | ### 1210.1 2289 | 2290 | Run your script to make sure it's working. 2291 | 2292 | #### HINTS 2293 | 2294 | - Type `./fortune.sh` in the terminal and press enter 2295 | - Make sure you are in the `project` folder first 2296 | 2297 | ## 1220. Add read QUESTION 2298 | 2299 | ### 1220.1 2300 | 2301 | In your function after you print the sentence, use `read` to get user input into a variable named `QUESTION`. 2302 | 2303 | #### HINTS 2304 | 2305 | - Add `read QUESTION` to your function below the `echo` 2306 | - Your function should look like this: 2307 | ```sh 2308 | GET_FORTUNE() { 2309 | echo Ask a yes or no question: 2310 | read QUESTION 2311 | } 2312 | ``` 2313 | - Your `echo ${RESPONSES[$N]}` command should be at the bottom of the file 2314 | 2315 | ## 1230. ./fortune.sh 2316 | 2317 | ### 1230.1 2318 | 2319 | Run the script again to test it out. Enter a question when it asks. 2320 | 2321 | #### HINTS 2322 | 2323 | - Type `./fortune.sh` in the terminal and press enter 2324 | - Make sure you are in the `project` folder first 2325 | 2326 | ## 1240. help 2327 | 2328 | ### 1240.1 2329 | 2330 | I want to make sure the input is a question. You are going to add a loop that asks for input until the input ends with a question mark. View the `help` menu to see if you can find an appropriate loop. 2331 | 2332 | #### HINTS 2333 | 2334 | - Type `help` in the terminal and press enter 2335 | 2336 | ## 1250. help until 2337 | 2338 | ### 1250.1 2339 | 2340 | View more about that `until` command. That might be the one to use here. 2341 | 2342 | #### HINTS 2343 | 2344 | - Use `help ` to view more about a command 2345 | - Type `help until` in the terminal and press enter 2346 | 2347 | ## 1260. Add until loop 2348 | 2349 | ### 1260.1 2350 | 2351 | The `until` loop is very similar to the `while` loop you used. It will execute the loop until a condition is met. Here's an example: 2352 | 2353 | ```sh 2354 | until [[ CONDITION ]] 2355 | do 2356 | STATEMENTS 2357 | done 2358 | ``` 2359 | 2360 | Add an `until` loop below your function. Use the double brackets to check if `QUESTION` is equal to `test?`. Move the `GET_FORTUNE` function call to the statements area of the loop. It should run the function until you input `test?` as the question. 2361 | 2362 | #### HINTS 2363 | 2364 | - View the `help [[` or `help test` menu to see if you can find the operator to use 2365 | - You want the `==` operator 2366 | - The condition should look like this: `[[ $QUESTION == test? ]]` 2367 | - Your `until` loop should look like this: 2368 | ```sh 2369 | until [[ $QUESTION == test? ]] 2370 | do 2371 | GET_FORTUNE 2372 | done 2373 | ``` 2374 | - You should only call the `GET_FORTUNE` function once 2375 | - Your `echo ${RESPONSES[$N]}` command should be at the bottom of the file 2376 | 2377 | ## 1270. ./fortune.sh 2378 | 2379 | ### 1270.1 2380 | 2381 | Run the script and enter something other than `test?`. Then enter `test?` after it asks for a question the second time. 2382 | 2383 | #### HINTS 2384 | 2385 | - Type `./fortune.sh` in the terminal and press enter 2386 | - Make sure you are in the `project` folder first 2387 | 2388 | ## 1280. help [[ expression ]] 2389 | 2390 | ### 1280.1 2391 | 2392 | View that `help [[ expression ]]` menu again. You need to find out how to test if the input ends with a question mark (`?`). 2393 | 2394 | #### HINTS 2395 | 2396 | - Type `help [[` or `help [[ expression ]]` in the terminal and press enter 2397 | 2398 | ## 1290. [[ hello == hello ]]; echo $? 2399 | 2400 | ### 1290.1 2401 | 2402 | Let's play with these again. You can test if two strings are the same with `==`. In the terminal, use the `[[ ... ]]; echo $?` syntax you used before to test if `hello` is equal to `hello`. 2403 | 2404 | #### HINTS 2405 | 2406 | - Be sure to use the `==` operator 2407 | - Type `[[ hello == hello ]]; echo $?` in the terminal and press enter 2408 | 2409 | ## 1300. [[ hello == world ]]; echo $? 2410 | 2411 | ### 1300.1 2412 | 2413 | Exit status of `0`, it was true. Using the same syntax, test if `hello` is equal to `world`. 2414 | 2415 | #### HINTS 2416 | 2417 | - Use the `[[ ... ]]; echo $?` syntax 2418 | - Be sure to use the `==` operator 2419 | - Type `[[ hello == world ]]; echo $?` in the terminal and press enter 2420 | 2421 | ## 1310. [[ hello =~ el ]]; echo $? 2422 | 2423 | ### 1310.1 2424 | 2425 | False. An important operator in that menu is `=~`. It allows for pattern matching. Using the same syntax but with this operator, check if `hello` contains the pattern `el`. 2426 | 2427 | #### HINTS 2428 | 2429 | - Use the `[[ ... ]]; echo $?` syntax 2430 | - Use the `=~` operator with it 2431 | - Type `[[ hello =~ el ]]; echo $?` in the terminal and press enter 2432 | 2433 | ## 1320. [[ "hello world" =~ "lo wor" ]]; echo $? 2434 | 2435 | ### 1320.1 2436 | 2437 | True. The condition was checking for `el` within the word `hello`. Using the same syntax, check if `hello world` contains the pattern `lo wor`. You will need to put them both in quotes so it recognizes the spaces. 2438 | 2439 | #### HINTS 2440 | 2441 | - Use the `[[ ... ]]; echo $?` syntax 2442 | - Use the `=~` operator with it 2443 | - Type `[[ "hello world" =~ "lo wor" ]]; echo $?` in the terminal and press enter 2444 | 2445 | ## 1330. [[ "hello world" =~ ^h ]]; echo $? 2446 | 2447 | ### 1330.1 2448 | 2449 | Your patterns have been checking for literal matches, `el` and `lo wor`. You can use regular expression characters as well, but you can't put the pattern in quotes when you do. Using the same syntax, check if `hello world` starts with an `h` by using `^h` as the pattern. 2450 | 2451 | #### HINTS 2452 | 2453 | - Make sure not to use quotes around the pattern when using regex characters it 2454 | - Type `[[ "hello world" =~ ^h ]]; echo $?` in the terminal 2455 | 2456 | ## 1340. [[ "hello world" =~ ^h.+d$ ]]; echo $? 2457 | 2458 | ### 1340.1 2459 | 2460 | Do it again, but use `^h.+d$` as the pattern to see if the string starts with an `h`, has at least one character after it, and ends with a `d`. 2461 | 2462 | #### HINTS 2463 | 2464 | - Use the `[[ ... ]]; echo $?` syntax again 2465 | - Check if `hello world` contains the suggested pattern 2466 | - Make sure not to use quotes around the pattern when using regex characters it 2467 | - Type `[[ "hello world" =~ ^h.+d$ ]]; echo $?` in the terminal 2468 | 2469 | ## 1350. VAR="hello world" 2470 | 2471 | ### 1350.1 2472 | 2473 | In the terminal, create a variable named `VAR` that equals `hello world`. 2474 | 2475 | #### HINTS 2476 | 2477 | - Type `VAR="hello world"` in the terminal 2478 | 2479 | ## 1360. echo $VAR 2480 | 2481 | ### 1360.1 2482 | 2483 | Use `echo` to print the variable you just created. 2484 | 2485 | #### HINTS 2486 | 2487 | - Type `echo $VAR` in the terminal 2488 | 2489 | ## 1370. [[ $VAR == "hello world" ]]; echo $? 2490 | 2491 | ### 1370.1 2492 | 2493 | Using the `[[ ... ]]; echo $?` syntax, check if your variable is equal to `hello world`. 2494 | 2495 | #### HINTS 2496 | 2497 | - Check the `help [[` menu to find the operator to use 2498 | - It's the `==` operator 2499 | - You want to check if `$VAR == "hello world"` 2500 | - Type `[[ $VAR == "hello world" ]]; echo $?` in the terminal 2501 | 2502 | ## 1380. [[ $VAR =~ \?$ ]; echo $? 2503 | 2504 | ### 1380.1 2505 | 2506 | Using the same syntax, check if your variable ends with `?` by using the pattern `\?$`. 2507 | 2508 | #### HINTS 2509 | 2510 | - Be sure to use the pattern matching operator 2511 | - It's the `=~` operator 2512 | - You want to check if `$VAR =~ \?$` 2513 | - Type `[[ $VAR =~ \?$ ]]; echo $?` in the terminal 2514 | 2515 | ## 1385. [[ test? =~ \?$ ]; echo $? 2516 | 2517 | ### 1385.1 2518 | 2519 | It doesn't end with `?`. Just to make sure I don't have the pattern wrong, check if `test?` ends with `?`. 2520 | 2521 | #### HINTS 2522 | 2523 | - Use the same `[[ ... ]]; echo $?` syntax you have been using 2524 | - Use the `\?$` pattern to see if a string ends with `?` 2525 | - Make sure you're using the pattern matching operator `=~` 2526 | - You want to check if `test? =~ \?$` 2527 | - Type `[[ test? =~ \?$ ]]; echo $?` in the terminal 2528 | 2529 | ## 1390. Change until condition 2530 | 2531 | ### 1390.1 2532 | 2533 | I think that will work. Back in your script, change the `until` condition to see if your variable ends with `?`. 2534 | 2535 | #### HINTS 2536 | 2537 | - Use the pattern matching operator with `\?$` 2538 | - It's the `=~` operator 2539 | - Your condition should look like this: `[[ $QUESTION =~ \?$ ]]` 2540 | - Make sure there's spaces inside the brackets and around the operator 2541 | 2542 | ## 1400. ./fortune.sh 2543 | 2544 | ### 1400.1 2545 | 2546 | Run the script and input something that doesn't end with `?` the first time, then something that does the second. 2547 | 2548 | #### HINTS 2549 | 2550 | - Type `./fortune.sh` in the terminal and press enter 2551 | - Make sure you are in the `project` folder first 2552 | 2553 | ## 1410. Add if to GET_FORTUNE 2554 | 2555 | ### 1410.1 2556 | 2557 | I know that it asks the same thing if the input isn't what you want. You should let users know that it needs to end with `?`. Add an `if` condition in your **function** that checks `if [[ ! $1 ]]`. Put the existing `echo` statement in the `then` area and make sure the existing `read` is below the whole `if` condition. 2558 | 2559 | #### HINTS 2560 | 2561 | - Here's an example: 2562 | ```sh 2563 | if [[ CONDITION ]] 2564 | then 2565 | STATEMENTS 2566 | fi 2567 | 2568 | read QUESTION 2569 | ``` 2570 | - Your function should look like this: 2571 | ```sh 2572 | function GET_FORTUNE() { 2573 | if [[ ! $1 ]] 2574 | then 2575 | echo Ask a yes or no question: 2576 | fi 2577 | 2578 | read QUESTION 2579 | } 2580 | ``` 2581 | 2582 | ## 1412. Add else to if [[ ! $1 ]] 2583 | 2584 | ### 1412.1 2585 | 2586 | You can pass arguments to functions like you did with your script. This condition will check if one isn't passed and print the sentence. Add an `else` to your `if`. Use `echo` to print `Try again. Make sure it ends with a question mark:` if the condition fails. 2587 | 2588 | #### HINTS 2589 | 2590 | - Here's an example: 2591 | ```sh 2592 | if [[ CONDITION ]] 2593 | then 2594 | STATEMENTS 2595 | else 2596 | STATEMENTS 2597 | fi 2598 | ``` 2599 | - Your `if` condition should look like this: 2600 | ```sh 2601 | if [[ ! $1 ]] 2602 | then 2603 | echo Ask a yes or no question: 2604 | else 2605 | echo Try again. Make sure it ends with a question mark: 2606 | fi 2607 | ``` 2608 | 2609 | ## 1413. Add argument to function call 2610 | 2611 | ### 1413.1 2612 | 2613 | Now, your function will print one thing if you pass it any argument, and something else if not. In the `until` loop, add `again` as an argument to where you call the function. 2614 | 2615 | #### HINTS 2616 | 2617 | - Here's an example: `FUNCTION_NAME argument` 2618 | - Your function call should look like this: `GET_FORTUNE again` 2619 | - Your `until` loop should look like this: 2620 | ```sh 2621 | until [[ $QUESTION =~ \?$ ]] 2622 | do 2623 | GET_FORTUNE again 2624 | done 2625 | ``` 2626 | 2627 | ## 1416. Add Initial function call 2628 | 2629 | ### 1416.1 2630 | 2631 | Now, each time the function is called in the `until` loop, it will pass `again` as an argument and print the `Try again...` sentence. Before your `until` loop, call the function without an argument so the first time it runs, it prints the initial sentence. 2632 | 2633 | #### HINTS 2634 | 2635 | - Add `GET_FORTUNE` before the `until` loop 2636 | 2637 | ## 1420. ./fortune.sh 2638 | 2639 | ### 1420.1 2640 | 2641 | Run the script and enter something without a question mark when it asks the first time. Use a question mark the second time. 2642 | 2643 | #### HINTS 2644 | 2645 | - Type `./fortune.sh` in the terminal and press enter 2646 | - Make sure you are in the `project` folder first 2647 | 2648 | ## 1425. Add line break in front of response 2649 | 2650 | ### 1425.1 2651 | 2652 | Awesome. One last thing. Add an empty line in front of where you print the response. 2653 | 2654 | #### HINTS 2655 | 2656 | - Change the existing `echo ${RESPONSES[$N]}` line 2657 | - Use the `-e` flag and the new line (`\n`) character with the `echo` statement 2658 | - Make sure to use quotes so it prints the new line 2659 | - Run the script and see if it's working 2660 | - The suggested command should look like this: `echo -e "\n${RESPONSES[$N]}"` 2661 | 2662 | ## 1428. ./fortune.sh 2663 | 2664 | ### 1428.1 2665 | 2666 | Run the script one more time to see if you like the output. 2667 | 2668 | #### HINTS 2669 | 2670 | - Type `./fortune.sh` in the terminal and press enter 2671 | - Make sure you are in the `project` folder first 2672 | 2673 | ## 1430. touch five.sh 2674 | 2675 | ### 1430.1 2676 | 2677 | Excellent. One last program to make. Use `touch` to create a new file named `five.sh` in the same folder as the others. 2678 | 2679 | #### HINTS 2680 | 2681 | - Type `touch five.sh` in the terminal and press enter 2682 | - Make sure you are in the `project` folder first 2683 | 2684 | ## 1440. chmod +x five.sh 2685 | 2686 | ### 1440.1 2687 | 2688 | Give your file executable permissions. 2689 | 2690 | #### HINTS 2691 | 2692 | - Use the `chmod` command with the `+x` flag 2693 | - Here's an example `chmod ` 2694 | - You previously used `chmod +x fortune.sh` 2695 | - Type `chmod +x five.sh` in the terminal and press enter 2696 | 2697 | ## 1450. Add shebang 2698 | 2699 | ### 1450.1 2700 | 2701 | Add a `shebang` to the new script that uses `bash` like the others. 2702 | 2703 | #### HINTS 2704 | 2705 | - A `shebang` looks like this: `#!` 2706 | - Enter `which bash` in the terminal to see the path to `bash` 2707 | - Look at the `shebang` in one of your other scripts to get the syntax 2708 | - It should look like this: `#!/bin/bash` 2709 | - Add `#!/bin/bash` at the top of your `five.sh` file 2710 | 2711 | ## 1460. Add comment 2712 | 2713 | ### 1460.1 2714 | 2715 | Add a comment below the `shebang` that says, `Program to run my other four programs` 2716 | 2717 | #### HINTS 2718 | 2719 | - Comments look like this: `# ` 2720 | - Add `# Program to run my other four programs` below the `shebang` 2721 | - Capitalization matters 2722 | 2723 | ## 1470. Add ./questionnaire.sh 2724 | 2725 | ### 1470.1 2726 | 2727 | This program will run all the programs you made so far consecutively. Add the command to run the `questionnaire.sh` file. 2728 | 2729 | #### HINTS 2730 | 2731 | - The command should look like how you would execute the file in the terminal 2732 | - Add `./questionnaire.sh` to the `five.sh` file 2733 | 2734 | ## 1480. ./five 2735 | 2736 | ### 1480.1 2737 | 2738 | Run the file to see if it works. Enter input when it asks. 2739 | 2740 | #### HINTS 2741 | 2742 | - Type `./five.sh` in the terminal and press enter 2743 | - Make sure you are in the `project` folder first 2744 | 2745 | ## 1490. Add the rest of the scripts 2746 | 2747 | ### 1490.1 2748 | 2749 | Add commands to run the rest of your scripts in the file. They should be in this order: `questionnaire`, `countdown`, `bingo`, and `fortune`. Don't forget that your `countdown.sh` file needs an argument, so put a `3` next to it. 2750 | 2751 | #### HINTS 2752 | 2753 | - Your `five.sh` file should have these commands: 2754 | ```sh 2755 | ./questionnaire.sh 2756 | ./countdown.sh 3 2757 | ./bingo.sh 2758 | ./fortune.sh 2759 | ``` 2760 | 2761 | ## 1500. Clear 2762 | 2763 | ### 1500.1 2764 | 2765 | Okay, use `clear` to empty out what's in the terminal before the big moment. 2766 | 2767 | #### HINTS 2768 | 2769 | - Type `clear` in the terminal 2770 | 2771 | ## 1510. ./five 2772 | 2773 | ### 1510.1 2774 | 2775 | Run the script and enter input when it asks. 2776 | 2777 | #### HINTS 2778 | 2779 | - Type `./five.sh` in the terminal and press enter 2780 | - Make sure you are in the `project` folder first 2781 | 2782 | ## 1520. help 2783 | 2784 | ### 1520.1 2785 | 2786 | Cool. I think all the scripts are done. View the `help` menu again I want to explore one more thing. 2787 | 2788 | #### HINTS 2789 | 2790 | - Type `help` in the terminal and press enter 2791 | 2792 | ## 1530. help type 2793 | 2794 | ### 1530.1 2795 | 2796 | View more about that `type` command. 2797 | 2798 | #### HINTS 2799 | 2800 | - Use `help ` to find out more about a command 2801 | - Type `help type` in the terminal and press enter 2802 | 2803 | ## 1540. type echo 2804 | 2805 | ### 1540.1 2806 | 2807 | It says you can view the type of a command with `type `. Just for fun, lets take a look at the type of a few different commands. View the type of `echo`. 2808 | 2809 | #### HINTS 2810 | 2811 | - Type `type echo` in the terminal and press enter 2812 | 2813 | ## 1550. type read 2814 | 2815 | ### 1550.1 2816 | 2817 | View the type of the `read` command. 2818 | 2819 | #### HINTS 2820 | 2821 | - Type `type read` in the terminal and press enter 2822 | 2823 | ## 1560. type if 2824 | 2825 | ### 1560.1 2826 | 2827 | View the type of `if` 2828 | 2829 | #### HINTS 2830 | 2831 | - Type `type if` in the terminal and press enter 2832 | 2833 | ## 1570. type then 2834 | 2835 | ### 1570.1 2836 | 2837 | View the type of `then` 2838 | 2839 | #### HINTS 2840 | 2841 | - Type `type then` in the terminal and press enter 2842 | 2843 | ## 1580. type bash 2844 | 2845 | ### 1580.1 2846 | 2847 | Those were all from the `help` menu and described as a `shell builtin` or `shell keyword`. View the type of `bash` 2848 | 2849 | #### HINTS 2850 | 2851 | - Type `type bash` in the terminal and press enter 2852 | 2853 | ## 1590. type psql 2854 | 2855 | ### 1590.1 2856 | 2857 | That's the location of the `bash` command. View the type of `psql`. 2858 | 2859 | #### HINTS 2860 | 2861 | - Type `type psql` in the terminal and press enter 2862 | 2863 | ## 1600. type ./five.sh 2864 | 2865 | ### 1600.1 2866 | 2867 | It's showing the location of the commands. View the type of your `./five.sh` file. 2868 | 2869 | #### HINTS 2870 | 2871 | - Type `type ./five.sh` in the terminal and press enter 2872 | 2873 | ## 1610. exit 2874 | 2875 | ### 1610.1 2876 | 2877 | Last step, close the terminal with the `exit` command. Thanks and happy coding! 2878 | 2879 | #### HINTS 2880 | 2881 | - Type `exit` in the terminal and press enter 2882 | -------------------------------------------------------------------------------- /coderoad.yaml: -------------------------------------------------------------------------------- 1 | id: 'freeCodeCamp/learn-bash-scripting-by-building-five-programs:v1.0.0' 2 | version: '2.0.0' 3 | config: 4 | setup: 5 | commands: 6 | - ./.freeCodeCamp/setup.sh 7 | - cd .freeCodeCamp && npm install 8 | testRunner: 9 | command: npm run programmatic-test 10 | args: 11 | tap: --reporter=mocha-tap-reporter 12 | directory: .freeCodeCamp 13 | repo: 14 | uri: https://github.com/freeCodeCamp/learn-bash-scripting-by-building-five-programs 15 | branch: v2.0.0 16 | continue: 17 | commands: 18 | - './.freeCodeCamp/setup.sh' 19 | - './.freeCodeCamp/reset.sh' 20 | reset: 21 | commands: 22 | - './.freeCodeCamp/setup.sh' 23 | - './.freeCodeCamp/reset.sh' 24 | dependencies: 25 | - name: node 26 | version: '>=10' 27 | webhook: 28 | url: 'https://api.freecodecamp.org/coderoad-challenge-completed' 29 | events: 30 | init: false 31 | reset: false 32 | step_complete: false 33 | level_complete: false 34 | tutorial_complete: true 35 | levels: 36 | - id: '10' 37 | steps: 38 | - id: '10.1' 39 | setup: 40 | watchers: 41 | - ../.bash_history 42 | - id: '20' 43 | steps: 44 | - id: '20.1' 45 | setup: 46 | watchers: 47 | - ../.bash_history 48 | - id: '30' 49 | steps: 50 | - id: '30.1' 51 | setup: 52 | watchers: 53 | - ./questionnaire.sh 54 | - id: '35' 55 | steps: 56 | - id: '35.1' 57 | setup: 58 | watchers: 59 | - ../.bash_history 60 | - id: '40' 61 | steps: 62 | - id: '40.1' 63 | setup: 64 | watchers: 65 | - ../.bash_history 66 | - id: '50' 67 | steps: 68 | - id: '50.1' 69 | setup: 70 | watchers: 71 | - ../.bash_history 72 | - id: '60' 73 | steps: 74 | - id: '60.1' 75 | setup: 76 | watchers: 77 | - ./questionnaire.sh 78 | - id: '70' 79 | steps: 80 | - id: '70.1' 81 | setup: 82 | watchers: 83 | - ../.bash_history 84 | - id: '80' 85 | steps: 86 | - id: '80.1' 87 | setup: 88 | watchers: 89 | - ../.bash_history 90 | - id: '90' 91 | steps: 92 | - id: '90.1' 93 | setup: 94 | watchers: 95 | - ../.bash_history 96 | - id: '100' 97 | steps: 98 | - id: '100.1' 99 | setup: 100 | watchers: 101 | - ../.bash_history 102 | - id: '110' 103 | steps: 104 | - id: '110.1' 105 | setup: 106 | watchers: 107 | - ../.bash_history 108 | - id: '140' 109 | steps: 110 | - id: '140.1' 111 | setup: 112 | watchers: 113 | - ./questionnaire.sh 114 | - id: '150' 115 | steps: 116 | - id: '150.1' 117 | setup: 118 | watchers: 119 | - ../.bash_history 120 | - id: '160' 121 | steps: 122 | - id: '160.1' 123 | setup: 124 | watchers: 125 | - ./questionnaire.sh 126 | - id: '170' 127 | steps: 128 | - id: '170.1' 129 | setup: 130 | watchers: 131 | - ./questionnaire.sh 132 | - id: '180' 133 | steps: 134 | - id: '180.1' 135 | setup: 136 | watchers: 137 | - ./questionnaire.sh 138 | - id: '190' 139 | steps: 140 | - id: '190.1' 141 | setup: 142 | watchers: 143 | - ../.bash_history 144 | - id: '200' 145 | steps: 146 | - id: '200.1' 147 | setup: 148 | watchers: 149 | - ./questionnaire.sh 150 | - id: '210' 151 | steps: 152 | - id: '210.1' 153 | setup: 154 | watchers: 155 | - ./questionnaire.sh 156 | - id: '220' 157 | steps: 158 | - id: '220.1' 159 | setup: 160 | watchers: 161 | - ../.bash_history 162 | - id: '230' 163 | steps: 164 | - id: '230.1' 165 | setup: 166 | watchers: 167 | - ./questionnaire.sh 168 | - id: '240' 169 | steps: 170 | - id: '240.1' 171 | setup: 172 | watchers: 173 | - ./questionnaire.sh 174 | - id: '250' 175 | steps: 176 | - id: '250.1' 177 | setup: 178 | watchers: 179 | - ./questionnaire.sh 180 | - id: '260' 181 | steps: 182 | - id: '260.1' 183 | setup: 184 | watchers: 185 | - ./questionnaire.sh 186 | - id: '270' 187 | steps: 188 | - id: '270.1' 189 | setup: 190 | watchers: 191 | - ../.bash_history 192 | - id: '280' 193 | steps: 194 | - id: '280.1' 195 | setup: 196 | watchers: 197 | - ./questionnaire.sh 198 | - id: '290' 199 | steps: 200 | - id: '290.1' 201 | setup: 202 | watchers: 203 | - ../.bash_history 204 | - id: '300' 205 | steps: 206 | - id: '300.1' 207 | setup: 208 | watchers: 209 | - ../.bash_history 210 | - id: '310' 211 | steps: 212 | - id: '310.1' 213 | setup: 214 | watchers: 215 | - ../.bash_history 216 | - id: '320' 217 | steps: 218 | - id: '320.1' 219 | setup: 220 | watchers: 221 | - ./questionnaire.sh 222 | - id: '323' 223 | steps: 224 | - id: '323.1' 225 | setup: 226 | watchers: 227 | - ../.bash_history 228 | - id: '326' 229 | steps: 230 | - id: '326.1' 231 | setup: 232 | watchers: 233 | - ./questionnaire.sh 234 | - id: '330' 235 | steps: 236 | - id: '330.1' 237 | setup: 238 | watchers: 239 | - ../.bash_history 240 | - id: '340' 241 | steps: 242 | - id: '340.1' 243 | setup: 244 | watchers: 245 | - ./questionnaire.sh 246 | - id: '345' 247 | steps: 248 | - id: '345.1' 249 | setup: 250 | watchers: 251 | - ./questionnaire.sh 252 | - id: '350' 253 | steps: 254 | - id: '350.1' 255 | setup: 256 | watchers: 257 | - ./questionnaire.sh 258 | - id: '360' 259 | steps: 260 | - id: '360.1' 261 | setup: 262 | watchers: 263 | - ./questionnaire.sh 264 | - id: '363' 265 | steps: 266 | - id: '363.1' 267 | setup: 268 | watchers: 269 | - ../.bash_history 270 | - id: '366' 271 | steps: 272 | - id: '366.1' 273 | setup: 274 | watchers: 275 | - ./questionnaire.sh 276 | - id: '370' 277 | steps: 278 | - id: '370.1' 279 | setup: 280 | watchers: 281 | - ../.bash_history 282 | - id: '380' 283 | steps: 284 | - id: '380.1' 285 | setup: 286 | watchers: 287 | - ../.bash_history 288 | - id: '390' 289 | steps: 290 | - id: '390.1' 291 | setup: 292 | watchers: 293 | - ../.bash_history 294 | - id: '400' 295 | steps: 296 | - id: '400.1' 297 | setup: 298 | watchers: 299 | - ./countdown.sh 300 | - id: '410' 301 | steps: 302 | - id: '410.1' 303 | setup: 304 | watchers: 305 | - ./countdown.sh 306 | - id: '420' 307 | steps: 308 | - id: '420.1' 309 | setup: 310 | watchers: 311 | - ./countdown.sh 312 | - id: '425' 313 | steps: 314 | - id: '425.1' 315 | setup: 316 | watchers: 317 | - ../.bash_history 318 | - id: '430' 319 | steps: 320 | - id: '430.1' 321 | setup: 322 | watchers: 323 | - ../.bash_history 324 | - id: '440' 325 | steps: 326 | - id: '440.1' 327 | setup: 328 | watchers: 329 | - ./countdown.sh 330 | - id: '450' 331 | steps: 332 | - id: '450.1' 333 | setup: 334 | watchers: 335 | - ../.bash_history 336 | - id: '460' 337 | steps: 338 | - id: '460.1' 339 | setup: 340 | watchers: 341 | - ../.bash_history 342 | - id: '470' 343 | steps: 344 | - id: '470.1' 345 | setup: 346 | watchers: 347 | - ../.bash_history 348 | - id: '480' 349 | steps: 350 | - id: '480.1' 351 | setup: 352 | watchers: 353 | - ../.bash_history 354 | - id: '490' 355 | steps: 356 | - id: '490.1' 357 | setup: 358 | watchers: 359 | - ./countdown.sh 360 | - id: '500' 361 | steps: 362 | - id: '500.1' 363 | setup: 364 | watchers: 365 | - ../.bash_history 366 | - id: '505' 367 | steps: 368 | - id: '505.1' 369 | setup: 370 | watchers: 371 | - ../.bash_history 372 | - id: '510' 373 | steps: 374 | - id: '510.1' 375 | setup: 376 | watchers: 377 | - ./countdown.sh 378 | - id: '520' 379 | steps: 380 | - id: '520.1' 381 | setup: 382 | watchers: 383 | - ../.bash_history 384 | - id: '530' 385 | steps: 386 | - id: '530.1' 387 | setup: 388 | watchers: 389 | - ./countdown.sh 390 | - id: '540' 391 | steps: 392 | - id: '540.1' 393 | setup: 394 | watchers: 395 | - ../.bash_history 396 | - id: '542' 397 | steps: 398 | - id: '542.1' 399 | setup: 400 | watchers: 401 | - ../.bash_history 402 | - id: '544' 403 | steps: 404 | - id: '544.1' 405 | setup: 406 | watchers: 407 | - ../.bash_history 408 | - id: '546' 409 | steps: 410 | - id: '546.1' 411 | setup: 412 | watchers: 413 | - ../.bash_history 414 | - id: '548' 415 | steps: 416 | - id: '548.1' 417 | setup: 418 | watchers: 419 | - ../.bash_history 420 | - id: '550' 421 | steps: 422 | - id: '550.1' 423 | setup: 424 | watchers: 425 | - ./countdown.sh 426 | - id: '552' 427 | steps: 428 | - id: '552.1' 429 | setup: 430 | watchers: 431 | - ../.bash_history 432 | - id: '554' 433 | steps: 434 | - id: '554.1' 435 | setup: 436 | watchers: 437 | - ../.bash_history 438 | - id: '556' 439 | steps: 440 | - id: '556.1' 441 | setup: 442 | watchers: 443 | - ../.bash_history 444 | - id: '558' 445 | steps: 446 | - id: '558.1' 447 | setup: 448 | watchers: 449 | - ../.bash_history 450 | - id: '560' 451 | steps: 452 | - id: '560.1' 453 | setup: 454 | watchers: 455 | - ../.bash_history 456 | - id: '562' 457 | steps: 458 | - id: '562.1' 459 | setup: 460 | watchers: 461 | - ../.bash_history 462 | - id: '564' 463 | steps: 464 | - id: '564.1' 465 | setup: 466 | watchers: 467 | - ../.bash_history 468 | - id: '566' 469 | steps: 470 | - id: '566.1' 471 | setup: 472 | watchers: 473 | - ../.bash_history 474 | - id: '568' 475 | steps: 476 | - id: '568.1' 477 | setup: 478 | watchers: 479 | - ../.bash_history 480 | - id: '570' 481 | steps: 482 | - id: '570.1' 483 | setup: 484 | watchers: 485 | - ../.bash_history 486 | - id: '572' 487 | steps: 488 | - id: '572.1' 489 | setup: 490 | watchers: 491 | - ../.bash_history 492 | - id: '574' 493 | steps: 494 | - id: '574.1' 495 | setup: 496 | watchers: 497 | - ../.bash_history 498 | - id: '575' 499 | steps: 500 | - id: '575.1' 501 | setup: 502 | watchers: 503 | - ../.bash_history 504 | - id: '576' 505 | steps: 506 | - id: '576.1' 507 | setup: 508 | watchers: 509 | - ../.bash_history 510 | - id: '582' 511 | steps: 512 | - id: '582.1' 513 | setup: 514 | watchers: 515 | - ../.bash_history 516 | - id: '584' 517 | steps: 518 | - id: '584.1' 519 | setup: 520 | watchers: 521 | - ../.bash_history 522 | - id: '586' 523 | steps: 524 | - id: '586.1' 525 | setup: 526 | watchers: 527 | - ../.bash_history 528 | - id: '588' 529 | steps: 530 | - id: '588.1' 531 | setup: 532 | watchers: 533 | - ./countdown.sh 534 | - id: '590' 535 | steps: 536 | - id: '590.1' 537 | setup: 538 | watchers: 539 | - ./countdown.sh 540 | - id: '600' 541 | steps: 542 | - id: '600.1' 543 | setup: 544 | watchers: 545 | - ../.bash_history 546 | - id: '610' 547 | steps: 548 | - id: '610.1' 549 | setup: 550 | watchers: 551 | - ../.bash_history 552 | - id: '615' 553 | steps: 554 | - id: '615.1' 555 | setup: 556 | watchers: 557 | - ../.bash_history 558 | - id: '620' 559 | steps: 560 | - id: '620.1' 561 | setup: 562 | watchers: 563 | - ./countdown.sh 564 | - id: '630' 565 | steps: 566 | - id: '630.1' 567 | setup: 568 | watchers: 569 | - ../.bash_history 570 | - id: '640' 571 | steps: 572 | - id: '640.1' 573 | setup: 574 | watchers: 575 | - ../.bash_history 576 | - id: '650' 577 | steps: 578 | - id: '650.1' 579 | setup: 580 | watchers: 581 | - ../.bash_history 582 | - id: '660' 583 | steps: 584 | - id: '660.1' 585 | setup: 586 | watchers: 587 | - ../.bash_history 588 | - id: '670' 589 | steps: 590 | - id: '670.1' 591 | setup: 592 | watchers: 593 | - ../.bash_history 594 | - id: '675' 595 | steps: 596 | - id: '675.1' 597 | setup: 598 | watchers: 599 | - ../.bash_history 600 | - id: '680' 601 | steps: 602 | - id: '680.1' 603 | setup: 604 | watchers: 605 | - ./countdown.sh 606 | - id: '690' 607 | steps: 608 | - id: '690.1' 609 | setup: 610 | watchers: 611 | - ../.bash_history 612 | - id: '692' 613 | steps: 614 | - id: '692.1' 615 | setup: 616 | watchers: 617 | - ./countdown.sh 618 | - id: '694' 619 | steps: 620 | - id: '694.1' 621 | setup: 622 | watchers: 623 | - ../.bash_history 624 | - id: '696' 625 | steps: 626 | - id: '696.1' 627 | setup: 628 | watchers: 629 | - ./countdown.sh 630 | - id: '698' 631 | steps: 632 | - id: '698.1' 633 | setup: 634 | watchers: 635 | - ../.bash_history 636 | - id: '700' 637 | steps: 638 | - id: '700.1' 639 | setup: 640 | watchers: 641 | - ./countdown.sh 642 | - id: '710' 643 | steps: 644 | - id: '710.1' 645 | setup: 646 | watchers: 647 | - ../.bash_history 648 | - id: '730' 649 | steps: 650 | - id: '730.1' 651 | setup: 652 | watchers: 653 | - ./countdown.sh 654 | - id: '740' 655 | steps: 656 | - id: '740.1' 657 | setup: 658 | watchers: 659 | - ./countdown.sh 660 | - id: '750' 661 | steps: 662 | - id: '750.1' 663 | setup: 664 | watchers: 665 | - ./countdown.sh 666 | - id: '760' 667 | steps: 668 | - id: '760.1' 669 | setup: 670 | watchers: 671 | - ./countdown.sh 672 | - id: '770' 673 | steps: 674 | - id: '770.1' 675 | setup: 676 | watchers: 677 | - ../.bash_history 678 | - id: '780' 679 | steps: 680 | - id: '780.1' 681 | setup: 682 | watchers: 683 | - ../.bash_history 684 | - id: '790' 685 | steps: 686 | - id: '790.1' 687 | setup: 688 | watchers: 689 | - ../.bash_history 690 | - id: '800' 691 | steps: 692 | - id: '800.1' 693 | setup: 694 | watchers: 695 | - ./bingo.sh 696 | - id: '810' 697 | steps: 698 | - id: '810.1' 699 | setup: 700 | watchers: 701 | - ./bingo.sh 702 | - id: '815' 703 | steps: 704 | - id: '815.1' 705 | setup: 706 | watchers: 707 | - ./bingo.sh 708 | - id: '817' 709 | steps: 710 | - id: '817.1' 711 | setup: 712 | watchers: 713 | - ./bingo.sh 714 | - id: '818' 715 | steps: 716 | - id: '818.1' 717 | setup: 718 | watchers: 719 | - ./bingo.sh 720 | - id: '819' 721 | steps: 722 | - id: '819.1' 723 | setup: 724 | watchers: 725 | - ../.bash_history 726 | - id: '820' 727 | steps: 728 | - id: '820.1' 729 | setup: 730 | watchers: 731 | - ../.bash_history 732 | - id: '822' 733 | steps: 734 | - id: '822.1' 735 | setup: 736 | watchers: 737 | - ../.bash_history 738 | - id: '824' 739 | steps: 740 | - id: '824.1' 741 | setup: 742 | watchers: 743 | - ../.bash_history 744 | - id: '826' 745 | steps: 746 | - id: '826.1' 747 | setup: 748 | watchers: 749 | - ../.bash_history 750 | - id: '828' 751 | steps: 752 | - id: '828.1' 753 | setup: 754 | watchers: 755 | - ./bingo.sh 756 | - id: '830' 757 | steps: 758 | - id: '830.1' 759 | setup: 760 | watchers: 761 | - ../.bash_history 762 | - id: '835' 763 | steps: 764 | - id: '835.1' 765 | setup: 766 | watchers: 767 | - ./bingo.sh 768 | - id: '840' 769 | steps: 770 | - id: '840.1' 771 | setup: 772 | watchers: 773 | - ../.bash_history 774 | - id: '881' 775 | steps: 776 | - id: '881.1' 777 | setup: 778 | watchers: 779 | - ../.bash_history 780 | - id: '884' 781 | steps: 782 | - id: '884.1' 783 | setup: 784 | watchers: 785 | - ../.bash_history 786 | - id: '887' 787 | steps: 788 | - id: '887.1' 789 | setup: 790 | watchers: 791 | - ../.bash_history 792 | - id: '890' 793 | steps: 794 | - id: '890.1' 795 | setup: 796 | watchers: 797 | - ../.bash_history 798 | - id: '891' 799 | steps: 800 | - id: '891.1' 801 | setup: 802 | watchers: 803 | - ../.bash_history 804 | - id: '893' 805 | steps: 806 | - id: '893.1' 807 | setup: 808 | watchers: 809 | - ../.bash_history 810 | - id: '896' 811 | steps: 812 | - id: '896.1' 813 | setup: 814 | watchers: 815 | - ../.bash_history 816 | - id: '897' 817 | steps: 818 | - id: '897.1' 819 | setup: 820 | watchers: 821 | - ../.bash_history 822 | - id: '899' 823 | steps: 824 | - id: '899.1' 825 | setup: 826 | watchers: 827 | - ../.bash_history 828 | - id: '902' 829 | steps: 830 | - id: '902.1' 831 | setup: 832 | watchers: 833 | - ../.bash_history 834 | - id: '905' 835 | steps: 836 | - id: '905.1' 837 | setup: 838 | watchers: 839 | - ../.bash_history 840 | - id: '908' 841 | steps: 842 | - id: '908.1' 843 | setup: 844 | watchers: 845 | - ../.bash_history 846 | - id: '911' 847 | steps: 848 | - id: '911.1' 849 | setup: 850 | watchers: 851 | - ../.bash_history 852 | - id: '912' 853 | steps: 854 | - id: '912.1' 855 | setup: 856 | watchers: 857 | - ../.bash_history 858 | - id: '913' 859 | steps: 860 | - id: '913.1' 861 | setup: 862 | watchers: 863 | - ../.bash_history 864 | - id: '914' 865 | steps: 866 | - id: '914.1' 867 | setup: 868 | watchers: 869 | - ../.bash_history 870 | - id: '916' 871 | steps: 872 | - id: '916.1' 873 | setup: 874 | watchers: 875 | - ../.bash_history 876 | - id: '918' 877 | steps: 878 | - id: '918.1' 879 | setup: 880 | watchers: 881 | - ../.bash_history 882 | - id: '920' 883 | steps: 884 | - id: '920.1' 885 | setup: 886 | watchers: 887 | - ../.bash_history 888 | - id: '928' 889 | steps: 890 | - id: '928.1' 891 | setup: 892 | watchers: 893 | - ./bingo.sh 894 | - id: '930' 895 | steps: 896 | - id: '930.1' 897 | setup: 898 | watchers: 899 | - ../.bash_history 900 | - id: '940' 901 | steps: 902 | - id: '940.1' 903 | setup: 904 | watchers: 905 | - ./bingo.sh 906 | - id: '945' 907 | steps: 908 | - id: '945.1' 909 | setup: 910 | watchers: 911 | - ../.bash_history 912 | - id: '950' 913 | steps: 914 | - id: '950.1' 915 | setup: 916 | watchers: 917 | - ./bingo.sh 918 | - id: '960' 919 | steps: 920 | - id: '960.1' 921 | setup: 922 | watchers: 923 | - ./bingo.sh 924 | - id: '970' 925 | steps: 926 | - id: '970.1' 927 | setup: 928 | watchers: 929 | - ./bingo.sh 930 | - id: '980' 931 | steps: 932 | - id: '980.1' 933 | setup: 934 | watchers: 935 | - ./bingo.sh 936 | - id: '990' 937 | steps: 938 | - id: '990.1' 939 | setup: 940 | watchers: 941 | - ./bingo.sh 942 | - id: '1000' 943 | steps: 944 | - id: '1000.1' 945 | setup: 946 | watchers: 947 | - ../.bash_history 948 | - id: '1010' 949 | steps: 950 | - id: '1010.1' 951 | setup: 952 | watchers: 953 | - ../.bash_history 954 | - id: '1020' 955 | steps: 956 | - id: '1020.1' 957 | setup: 958 | watchers: 959 | - ../.bash_history 960 | - id: '1030' 961 | steps: 962 | - id: '1030.1' 963 | setup: 964 | watchers: 965 | - ./fortune.sh 966 | - id: '1040' 967 | steps: 968 | - id: '1040.1' 969 | setup: 970 | watchers: 971 | - ./fortune.sh 972 | - id: '1050' 973 | steps: 974 | - id: '1050.1' 975 | setup: 976 | watchers: 977 | - ./fortune.sh 978 | - id: '1060' 979 | steps: 980 | - id: '1060.1' 981 | setup: 982 | watchers: 983 | - ../.bash_history 984 | - id: '1070' 985 | steps: 986 | - id: '1070.1' 987 | setup: 988 | watchers: 989 | - ../.bash_history 990 | - id: '1080' 991 | steps: 992 | - id: '1080.1' 993 | setup: 994 | watchers: 995 | - ../.bash_history 996 | - id: '1090' 997 | steps: 998 | - id: '1090.1' 999 | setup: 1000 | watchers: 1001 | - ../.bash_history 1002 | - id: '1100' 1003 | steps: 1004 | - id: '1100.1' 1005 | setup: 1006 | watchers: 1007 | - ../.bash_history 1008 | - id: '1110' 1009 | steps: 1010 | - id: '1110.1' 1011 | setup: 1012 | watchers: 1013 | - ./fortune.sh 1014 | - id: '1120' 1015 | steps: 1016 | - id: '1120.1' 1017 | setup: 1018 | watchers: 1019 | - ./fortune.sh 1020 | - id: '1130' 1021 | steps: 1022 | - id: '1130.1' 1023 | setup: 1024 | watchers: 1025 | - ../.bash_history 1026 | - id: '1140' 1027 | steps: 1028 | - id: '1140.1' 1029 | setup: 1030 | watchers: 1031 | - ./fortune.sh 1032 | - id: '1150' 1033 | steps: 1034 | - id: '1150.1' 1035 | setup: 1036 | watchers: 1037 | - ./fortune.sh 1038 | - id: '1160' 1039 | steps: 1040 | - id: '1160.1' 1041 | setup: 1042 | watchers: 1043 | - ../.bash_history 1044 | - id: '1170' 1045 | steps: 1046 | - id: '1170.1' 1047 | setup: 1048 | watchers: 1049 | - ../.bash_history 1050 | - id: '1180' 1051 | steps: 1052 | - id: '1180.1' 1053 | setup: 1054 | watchers: 1055 | - ./fortune.sh 1056 | - id: '1190' 1057 | steps: 1058 | - id: '1190.1' 1059 | setup: 1060 | watchers: 1061 | - ./fortune.sh 1062 | - id: '1200' 1063 | steps: 1064 | - id: '1200.1' 1065 | setup: 1066 | watchers: 1067 | - ./fortune.sh 1068 | - id: '1210' 1069 | steps: 1070 | - id: '1210.1' 1071 | setup: 1072 | watchers: 1073 | - ../.bash_history 1074 | - id: '1220' 1075 | steps: 1076 | - id: '1220.1' 1077 | setup: 1078 | watchers: 1079 | - ./fortune.sh 1080 | - id: '1230' 1081 | steps: 1082 | - id: '1230.1' 1083 | setup: 1084 | watchers: 1085 | - ../.bash_history 1086 | - id: '1240' 1087 | steps: 1088 | - id: '1240.1' 1089 | setup: 1090 | watchers: 1091 | - ../.bash_history 1092 | - id: '1250' 1093 | steps: 1094 | - id: '1250.1' 1095 | setup: 1096 | watchers: 1097 | - ../.bash_history 1098 | - id: '1260' 1099 | steps: 1100 | - id: '1260.1' 1101 | setup: 1102 | watchers: 1103 | - ./fortune.sh 1104 | - id: '1270' 1105 | steps: 1106 | - id: '1270.1' 1107 | setup: 1108 | watchers: 1109 | - ../.bash_history 1110 | - id: '1280' 1111 | steps: 1112 | - id: '1280.1' 1113 | setup: 1114 | watchers: 1115 | - ../.bash_history 1116 | - id: '1290' 1117 | steps: 1118 | - id: '1290.1' 1119 | setup: 1120 | watchers: 1121 | - ../.bash_history 1122 | - id: '1300' 1123 | steps: 1124 | - id: '1300.1' 1125 | setup: 1126 | watchers: 1127 | - ../.bash_history 1128 | - id: '1310' 1129 | steps: 1130 | - id: '1310.1' 1131 | setup: 1132 | watchers: 1133 | - ../.bash_history 1134 | - id: '1320' 1135 | steps: 1136 | - id: '1320.1' 1137 | setup: 1138 | watchers: 1139 | - ../.bash_history 1140 | - id: '1330' 1141 | steps: 1142 | - id: '1330.1' 1143 | setup: 1144 | watchers: 1145 | - ../.bash_history 1146 | - id: '1340' 1147 | steps: 1148 | - id: '1340.1' 1149 | setup: 1150 | watchers: 1151 | - ../.bash_history 1152 | - id: '1350' 1153 | steps: 1154 | - id: '1350.1' 1155 | setup: 1156 | watchers: 1157 | - ../.bash_history 1158 | - id: '1360' 1159 | steps: 1160 | - id: '1360.1' 1161 | setup: 1162 | watchers: 1163 | - ../.bash_history 1164 | - id: '1370' 1165 | steps: 1166 | - id: '1370.1' 1167 | setup: 1168 | watchers: 1169 | - ../.bash_history 1170 | - id: '1380' 1171 | steps: 1172 | - id: '1380.1' 1173 | setup: 1174 | watchers: 1175 | - ../.bash_history 1176 | - id: '1385' 1177 | steps: 1178 | - id: '1385.1' 1179 | setup: 1180 | watchers: 1181 | - ../.bash_history 1182 | - id: '1390' 1183 | steps: 1184 | - id: '1390.1' 1185 | setup: 1186 | watchers: 1187 | - ./fortune.sh 1188 | - id: '1400' 1189 | steps: 1190 | - id: '1400.1' 1191 | setup: 1192 | watchers: 1193 | - ../.bash_history 1194 | - id: '1410' 1195 | steps: 1196 | - id: '1410.1' 1197 | setup: 1198 | watchers: 1199 | - ./fortune.sh 1200 | - id: '1412' 1201 | steps: 1202 | - id: '1412.1' 1203 | setup: 1204 | watchers: 1205 | - ./fortune.sh 1206 | - id: '1413' 1207 | steps: 1208 | - id: '1413.1' 1209 | setup: 1210 | watchers: 1211 | - ./fortune.sh 1212 | - id: '1416' 1213 | steps: 1214 | - id: '1416.1' 1215 | setup: 1216 | watchers: 1217 | - ./fortune.sh 1218 | - id: '1420' 1219 | steps: 1220 | - id: '1420.1' 1221 | setup: 1222 | watchers: 1223 | - ../.bash_history 1224 | - id: '1425' 1225 | steps: 1226 | - id: '1425.1' 1227 | setup: 1228 | watchers: 1229 | - ./fortune.sh 1230 | - id: '1428' 1231 | steps: 1232 | - id: '1428.1' 1233 | setup: 1234 | watchers: 1235 | - ../.bash_history 1236 | - id: '1430' 1237 | steps: 1238 | - id: '1430.1' 1239 | setup: 1240 | watchers: 1241 | - ../.bash_history 1242 | - id: '1440' 1243 | steps: 1244 | - id: '1440.1' 1245 | setup: 1246 | watchers: 1247 | - ../.bash_history 1248 | - id: '1450' 1249 | steps: 1250 | - id: '1450.1' 1251 | setup: 1252 | watchers: 1253 | - ./five.sh 1254 | - id: '1460' 1255 | steps: 1256 | - id: '1460.1' 1257 | setup: 1258 | watchers: 1259 | - ./five.sh 1260 | - id: '1470' 1261 | steps: 1262 | - id: '1470.1' 1263 | setup: 1264 | watchers: 1265 | - ./five.sh 1266 | - id: '1480' 1267 | steps: 1268 | - id: '1480.1' 1269 | setup: 1270 | watchers: 1271 | - ../.bash_history 1272 | - id: '1490' 1273 | steps: 1274 | - id: '1490.1' 1275 | setup: 1276 | watchers: 1277 | - ./five.sh 1278 | - id: '1500' 1279 | steps: 1280 | - id: '1500.1' 1281 | setup: 1282 | watchers: 1283 | - ../.bash_history 1284 | - id: '1510' 1285 | steps: 1286 | - id: '1510.1' 1287 | setup: 1288 | watchers: 1289 | - ../.bash_history 1290 | - id: '1520' 1291 | steps: 1292 | - id: '1520.1' 1293 | setup: 1294 | watchers: 1295 | - ../.bash_history 1296 | - id: '1530' 1297 | steps: 1298 | - id: '1530.1' 1299 | setup: 1300 | watchers: 1301 | - ../.bash_history 1302 | - id: '1540' 1303 | steps: 1304 | - id: '1540.1' 1305 | setup: 1306 | watchers: 1307 | - ../.bash_history 1308 | - id: '1550' 1309 | steps: 1310 | - id: '1550.1' 1311 | setup: 1312 | watchers: 1313 | - ../.bash_history 1314 | - id: '1560' 1315 | steps: 1316 | - id: '1560.1' 1317 | setup: 1318 | watchers: 1319 | - ../.bash_history 1320 | - id: '1570' 1321 | steps: 1322 | - id: '1570.1' 1323 | setup: 1324 | watchers: 1325 | - ../.bash_history 1326 | - id: '1580' 1327 | steps: 1328 | - id: '1580.1' 1329 | setup: 1330 | watchers: 1331 | - ../.bash_history 1332 | - id: '1590' 1333 | steps: 1334 | - id: '1590.1' 1335 | setup: 1336 | watchers: 1337 | - ../.bash_history 1338 | - id: '1600' 1339 | steps: 1340 | - id: '1600.1' 1341 | setup: 1342 | watchers: 1343 | - ../.bash_history 1344 | - id: '1610' 1345 | steps: 1346 | - id: '1610.1' 1347 | setup: 1348 | watchers: 1349 | - ../.bash_history 1350 | --------------------------------------------------------------------------------