From 7b771e17420d38f91b7e141e82936f3ab4c59ed2 Mon Sep 17 00:00:00 2001 From: eslopfer Date: Wed, 4 Jan 2023 07:26:17 +0000 Subject: [PATCH] docs(plus): add description of subject --- subjects/plus/README.md | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 subjects/plus/README.md diff --git a/subjects/plus/README.md b/subjects/plus/README.md new file mode 100644 index 000000000..4e781b1d4 --- /dev/null +++ b/subjects/plus/README.md @@ -0,0 +1,43 @@ +## plus + +### Instructions + +In this exercise, you will make a script that will take two arguments from the command line, add them and output the result. + +### Usage + +```console +$ ./plus.sh 2 3 | cat -e +5$ +$ +``` + +### Hints + +Here are some commands that you can combine to find the solution: + +- `expr`: this command evaluates an expression and outputs the result. + +- `command substitution - $(...)`: this command can be used to interpolate the output of running a command into a string. You can replace the ellipsis with your command. + +You could use `expr` like this: + +```console +$ expr 2 - 2 +0$ +$ +``` + +And `$(...)` like this: + +```console +$ echo "This is the content of a file: $(cat file.txt)" +This is the content of a file: `$ +$ +``` + +### Notions + +- [expr](https://www.gnu.org/software/coreutils/manual/html_node/expr-invocation.html#expr-invocation). + +- [command substitution](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Command-Substitution).