This folder contains small practice programs based on the module topics:
- Introduction to command line and navigation
- Shell scripting
- Cron jobs
- AWK
These examples are written for Linux or WSL. If you open this repository from Windows, run the scripts in:
- WSL Ubuntu
- Git Bash
- Any Linux terminal
shell/- basic shell scripting examplescron/- cron job examples and a simple scheduled scriptawk/- AWK practice files and sample datatasks/- assignment questions and sample answers
Give execute permission first:
chmod +x Practice/shell/*.sh
chmod +x Practice/cron/*.shRun an example:
bash Practice/shell/01_simple_script.shRun a script with input:
bash Practice/shell/03_input_output.shRun an AWK example:
awk -f Practice/awk/01_print_fields.awk Practice/awk/students.txt- Command and navigation:
pwdlscdmkdircpmvrm
- User and permission concept:
whoamiidls -lchmod
- Text editor in CLI:
nanovim
01_simple_script.sh- simple shell script02_variables.sh- variables03_input_output.sh- input and output04_quoting.sh- single quotes, double quotes, escaping05_operators.sh- arithmetic and comparison operators06_conditional.sh- if, elif, else07_looping.sh- for and while loops08_function.sh- functions09_file_tools.sh- combines commands into one useful mini program10_arguments.sh- command line arguments11_case_menu.sh-casestatement example12_file_check.sh- check whether a file or directory exists13_mini_project.sh- mini project that combines input, condition, loop, and function
backup_logs.sh- a script that can be scheduled with croncrontab_examples.txt- ready-to-study cron expressionscleanup_temp.sh- example cleanup script for scheduled execution
students.txt- sample data01_print_fields.awk- print selected fields02_begin_end.awk- useBEGINandEND03_filter_and_average.awk- filter data and calculate average04_department_count.awk- count students per department05_pass_fail.awk- label pass and fail status
- Read the shell scripts from top to bottom.
- Run each script and change some values.
- Study the cron expressions.
- Run the AWK programs using
students.txt. - Modify one script and create your own version.
Command line arguments:
bash Practice/shell/10_arguments.sh Lina 90Check a file or directory:
bash Practice/shell/12_file_check.sh Practice/awk/students.txtRun the mini project:
bash Practice/shell/13_mini_project.shCount departments with AWK:
awk -f Practice/awk/04_department_count.awk Practice/awk/students.txt- These files are intentionally simple so they are easy to explain in class or submit as practice.
- You can extend them later with command line arguments, file input, and more validation.
- Read tasks/questions.md for 10 short exercises.
- Sample solutions are available in
tasks/answers/.