wordcount script to get wordcount for specific user
This commit is contained in:
parent
c767371fdb
commit
5d8569c6e8
|
@ -11,7 +11,7 @@ temp_scores=$(mktemp -t "$(basename "$0").scores.XXXXXXX") || exit 1
|
|||
|
||||
for u in $(voyagers); do
|
||||
if ls /home/"${u}"/ships/**/*.txt &> /dev/null; then
|
||||
words=$(wc -w /home/"${u}"/ships/**/*.txt | tail -n 1 | awk '{print $1}')
|
||||
words=$(wordcount "${u}")
|
||||
printf "%s,%s\\n" "$u" "$words" >> "$temp_scores"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
if [ -d "/home/${1:-$USER}/ships/" ]; then
|
||||
wc -w /home/"${1:-$USER}"/ships/**/*.txt | tail -n 1 | awk '{print $1}'
|
||||
else
|
||||
printf "0\\n"
|
||||
fi
|
Loading…
Reference in New Issue