mirror of
https://github.com/bregman-arie/devops-exercises.git
synced 2026-02-05 16:19:10 +00:00
Name it instead "topics" so it won't be strange if some topics included "exercises" directory.
429 B
429 B
Count Chars
Objectives
- Read input from the user until you get empty string
- For each of the lines you read, count the number of characters and print it
Constraints
- You must use a while loop
- Assume at least three lines of input
Solution
#!/usr/bin/env bash
echo -n "Please insert your input: "
while read line; do
echo -n "$line" | wc -c
echo -n "Please insert your input: "
done