I am making a script that allows users to save their settings in a text file. If they want to use the saved settings, they will need to input the name of the settings. Then the script will compare the user's input to find for the name in the text file. If it finds a matching name, it will extract the whole line from that text file. So far my code looks like this.
echo enter setting name
read name
#count=0
while IFS= read line
do
if [ "$name" == "$settingName" ]
then
cp **/*"$ft1" $dir1
else
echo "file doesnt exist"
fi
done < preco.txt
The code i used to save the variables:
echo save settings?
read decision
if [ "$decision" = "y" ]
then
echo enter settings name
read settingName
echo $settingName $dir1 $ft1 >> preco.txt
else
echo "bye"
exit
I want the $dir1 and $ft1 to input into cp