In this project, i learned about linux expansion, shell arithmetic ,shell initialization files and shell variables
- printenv
- set
- unset
- export
- alias
- unalias
- .
- source
- printf
- What happens when you type $ ls -l *.txt
- What are the /etc/profile file and the /etc/profile.d directory
- What is the ~/.bashrc file
- What is the difference between a local and a global variable
- What is a reserved variable
- How to create, update and delete shell variables
- What are the roles of the following reserved variables: HOME, PATH, PS1
- What are special parameters
- What is the special parameter $??
- What is expansion and how to use them
- What is the difference between single and double quotes and how to use them properly
- How to do command substitution with $() and backticks
- How to perform arithmetic operations with the shell
- How to create an alias
- How to list aliases
- How to temporarily disable an alias
- Allowed editors: vi, vim, emacs
- All your scripts will be tested on Ubuntu 20.04 LTS
- All your scripts should be exactly two lines long ($ wc -l file should print 2)
- The first line of all your files should be exactly #!/bin/bash
- A README.md file, at the root of the folder of the project, describing what each script is doing
- You are not allowed to use &&, || or ;
- You are not allowed to use bc, sed or awk
- All your files must be executable
Read your /etc/profile, /etc/inputrc and ~/.bashrc files.
Look at some files in the /etc/profile.d directory.
Note: You do not have to learn about awk, tar, bzip2, date, scp, ulimit, umask, or shell scripting, yet.
- <o> : A script that creates an alias.
- Name of alias:
ls
- Value:
rm *
- Name of alias:
- Hello you : A script that prints
hello user
, where user is the current Linux user. - The path to success is to take massive, determined action : A script that adds
/action
to thePATH
./action
should be the last directory the shell looks into when looking for a program. - If the path be beautiful, let us not ask where it leads : A script that counts the number of directories in the
PATH
. - Global variables : A script that prints all the enviroment variables.
- Local variables : A script that lists all local variables and enviroment variables, and functions.
- Name of variable :
HOLBERTON
- Value :
Betty
- Name of variable :
- Local variable : A script that creates a new local variable.
- Global variable : A script that creates a new global variable.
- Name of variable :
HOLBERTON
- Value :
Betty
- Name of variable :
- Every addition to true knowledge is an addition to human power : A script that prints the results of the addition of 128 with the value stored in the enviroment variable
TRUEKNOWLEDGE
, followed by a new line.- Remember to export variable TRUEKNOWLEDGE :
export TRUEKNOWLEDGE=1209
- Run command this way:
./8-true_knowledge | cat -e
- Remember to export variable TRUEKNOWLEDGE :
- Divide and rule : A script that prints the result of
POWER
divide byDIVIDE
, followed by a new line.POWER
andDIVIDE
are environment variables.- Variables values;
- export POWER=42784
- export DIVIDE=32
- Run command this way:
./9-divide_and_rule | cat -e
- Love is anterior to life, posterior to death, initial of creation, and the exponent of breath : A script that displays the result of
BREATH
to the power ofLOVE
.BREATH
andLOVE
are enviroment variables.- The script should display the result, followed by a new line.
- There are 10 types of people in the world -- Those who understand binary, and those who don't : A script that converts a number from base 2 to base 10.
- The number in base 2 is stored in the enviroment variable
BINARY
. - The script should display the number in base 10, followed by a new line.
- The number in base 2 is stored in the enviroment variable
- Combination : A script that prints all possible combinations of two letters, except
oo
.- Letters are lower cases, from
a
toz
. - One combination per line.
- The output should be alpha ordered, starting with
aa
. - Do not print
oo
. - Your script file should contain maximum 64 characters.
- Letters are lower cases, from
- Floats : A script that prints a number with two decimal places, followed by a new line.
- The number will be stored in the enviroment variable
NUM
.
- The number will be stored in the enviroment variable
- Decimal to Hexadecimal : A script that converts a number from base 10 to base 16.
- The number is base 10 is stored in the enviroment variable
DECIMAL
. - The script should display the number in base 16, followed by a new line.
- The number is base 10 is stored in the enviroment variable
- Everyone is a proponent of strong encryption : A script that encodes and decodes text using the rot13 encryption. Assume ASCII.
- The eggs of the brood need to be an odd number : A script that prints every other line from the input, starting with the first line.
- I'm an instant star. Just add water and stir. : A script that adds the two numbers stored in the enviroment variables
WATER
andSTIR
and prints the results.WATER
is in basewater
.STIR
is in basestir
.- The result should be in base
behlnort
.