Skip to content

Instantly share code, notes, and snippets.

@pathologicalhandwaving
Created January 16, 2017 14:14
Show Gist options
  • Select an option

  • Save pathologicalhandwaving/024d1b4599e9892b4b9caa0bc6331f10 to your computer and use it in GitHub Desktop.

Select an option

Save pathologicalhandwaving/024d1b4599e9892b4b9caa0bc6331f10 to your computer and use it in GitHub Desktop.
Shell script for adding definitions to a yaml file
#!/bin/bash
FILE="$HOME/School/Classes/MIT6001x/Notes/gloss.yml"
clear
# Get User Input
read -p 'Term: ' term
read -p 'Term Label: ' label
read -p 'Term Description: ' descr
# STDOUT Test
#echo " "
#echo "Term Entered: " $term
#echo "Term Label Entered: " $label
#echo "Term Description Entered: " $descr
#echo " "
# Write to file
echo " "
echo "label: $label" >> $FILE
echo "subvalue:" >> $FILE
echo " term: $term" >> $FILE
echo " description: >" >> $FILE
echo " $descr" >> $FILE
echo " " >> $FILE
# STDOUT Last Entry
cat $FILE | tail -7
# Exit
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment