Trying to get bash to combine read and sed to insert a variable into a script. Doesn't necessarily have to be sed but something along those lines.
Something like so:
INTERNAL="`read -p "PATH " path` | sed -i '3i\$INTERNAL="/run/media/blah" blah.sh
I could also implement python as well. My project is written in shell but I could use a
setup.py script for the initial run.
I'm trying to make a smart script to setup variables during the first run and save them for future usage. In this case it's a path to an external/internal device to backup $HOME. I am going to make the script search for a file:
$HOME/.already_ran.txt(hidden dummy file for the script to search for to see if it's been ran before) If it doesn't find that file, it will prompt the user to enter the variables, in this case the paths. I don't want to have them have to open up the script manually and add the variable.