mirror of
https://github.com/G2-Games/anagram-finder.git
synced 2025-04-19 19:22:53 -05:00
Fixed some minor things
This commit is contained in:
parent
73941d6c95
commit
577143b1d4
1 changed files with 5 additions and 1 deletions
6
anagram.sh
Normal file → Executable file
6
anagram.sh
Normal file → Executable file
|
@ -1,5 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
word=$1
|
word=$(echo $1 | xargs)
|
||||||
|
if [[ $word = "" ]]; then
|
||||||
|
echo "usage: ./anagram.sh <word>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
wordsorted=$(echo $word | grep -o . | sort | tr -d "\n")
|
wordsorted=$(echo $word | grep -o . | sort | tr -d "\n")
|
||||||
lines=$(grep -xin -- "$wordsorted" sortedwords.txt | sed -e 's/:.*//g')
|
lines=$(grep -xin -- "$wordsorted" sortedwords.txt | sed -e 's/:.*//g')
|
||||||
if [[ $lines = "" ]]; then
|
if [[ $lines = "" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue