Skip to content

Instantly share code, notes, and snippets.

@yochem
Last active September 10, 2019 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yochem/6dc68d9510524bb076bc833d8acf3ea8 to your computer and use it in GitHub Desktop.
Save yochem/6dc68d9510524bb076bc833d8acf3ea8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# use current directory if not specified
feedback_folder="${1:-$(pwd)}"
if [ "$(uname)" == "Darwin" ]; then
copy_tool="pbcopy"
else
copy_tool="xclip -i -selection c"
fi
echo -e "Press any key to copy the next student's feedback.\n"
for i in "$feedback_folder"/*.txt; do
# check if file exists
[ ! -e "$i" ] && exit 1
"$copy_tool" "$i"
echo "Copied content of $(basename $i) to clipboard"
read -n 1 -s
done
# clean up clipboard
echo "" | "$copy_tool"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment