mirror of
https://github.com/bregman-arie/devops-exercises.git
synced 2026-02-04 23:59:11 +00:00
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