Solution for pangram
This commit is contained in:
parent
fcae51f2c2
commit
56fc641009
@ -1,24 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# The following comments should help you get started:
|
# Convert to lowercase and remove non-alphabetic characters
|
||||||
# - Bash is flexible. You may use functions or write a "raw" script.
|
sentence_alpha="$(echo "$1" | tr '[:upper:]' '[:lower:]' | tr -cd '[:alpha:]')"
|
||||||
#
|
|
||||||
# - Complex code can be made easier to read by breaking it up
|
# `fold -w1` splits the string into individual characters, one per line
|
||||||
# into functions, however this is sometimes overkill in bash.
|
# `sort -u` remove duplicates
|
||||||
#
|
# `tr` delete newline characters
|
||||||
# - You can find links about good style and other resources
|
sentence_unique="$(echo -n "${sentence_alpha}" | fold -w1 | sort -u | tr -d '\n')"
|
||||||
# for Bash in './README.md'. It came with this exercise.
|
|
||||||
#
|
# Check if the unique alphabets count is 26 (total number of English alphabets)
|
||||||
# Example:
|
if [[ ${#sentence_unique} == 26 ]]; then
|
||||||
# # other functions here
|
echo "true"
|
||||||
# # ...
|
else
|
||||||
# # ...
|
echo "false"
|
||||||
#
|
fi
|
||||||
# main () {
|
|
||||||
# # your main function code here
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# # call main with all of the positional arguments
|
|
||||||
# main "$@"
|
|
||||||
#
|
|
||||||
# *** PLEASE REMOVE THESE COMMENTS BEFORE SUBMITTING YOUR SOLUTION ***
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user