I am very new to making bash scripts, but my goal here is to take a .txt file I have and assign the string of words in the txt file to a variable. I have tried this (no clue
The $() construction returns the stdout from a command.
file_contents=$(cat answer.txt)
In bash $(< answer.txt) is a builtin
shorthand for $(cat answer.txt)
I suspect you're running this print:
NAME
run-mailcap, see, edit, compose, print − execute programs via entries in the mailcap file
You need the backticks to capture output from a command (and you probably want echo instead of print):
file1=`cat answer.txt`
echo $file1