-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbash_fn
More file actions
24 lines (16 loc) · 725 Bytes
/
bash_fn
File metadata and controls
24 lines (16 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source ${DIR}/helper_fn
function greeting() {
define_shuf
define_ls
nationalGreeting=`${SHUF} -n 1 ${DIR}/greetings.txt`
helloVal=`echo ${nationalGreeting} | cut -d "," -f1`
nationality=`echo ${nationalGreeting} | cut -d "," -f2`
character=`${LS} ${DIR}/characters | grep -i "^${nationality:0:1}" | ${SHUF} -n 1`
name=`cat ${DIR}/names.txt | grep "^${character:0:1}"| ${SHUF} -n 1`
userFullName=`finger $USER | head -n1 | cut -d ":" -f3 | xargs`
cat <<GREET_MSG
`cat ${DIR}/characters/${character}`
`uppercase_first ${name}` the ${nationality} `uppercase_first ${character}` says "${helloVal}, ${userFullName}!" :)
GREET_MSG
}