Created
November 16, 2016 14:17
-
-
Save mtorrisi/254d482cc64b4a36175fd39aa775a2fc to your computer and use it in GitHub Desktop.
Demo sayhello script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INPFILE=sayhello.txt | |
DATAFILE=sayhello.data | |
DELAY=2 | |
printf "starting at: " ; date | |
printf "running on: "; $(hostname -f) | |
printf "whoami: "; whoami | |
printf "home: "; echo $HOME | |
printf "listing home:\n" | |
ls -l $HOME | |
printf "working directory: "; pwd | |
printf "listing working directory:\n" | |
ls -l $PWD | |
if [ "${@}" = "" ]; then | |
SAYS="nothing" | |
else | |
SAYS="$@" | |
fi | |
echo "User "$(whoami)" says: $SAYS" | tee -i $DATAFILE | |
if [ -f "$INPFILE" ]; then | |
echo "Receiving sayhello.txt file" | |
cat $INPFILE | |
else | |
echo "Did not find $INPFILE" | |
fi | |
printf "waiting for a while ($DELAY minutes) ... " | |
sleep $((60*DELAY)) # Wait few minutes | |
echo "done" | |
printf "ending at: "; date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment