I have a file with elements a,b,c which I want to replace with proper values that I input in the terminal. I am making use of a .bashrc script named hi.sh.
I input the filename containing the elements a,b,c as a ifile and want to write it in a new file which I have defined as ofile.
The script I have prepared is:
#!/bin/bash
read date tm MJD ifile ofile
echo Enter date (DD/MM/YYYY) : $date
echo Enter IST - 5:30 HRS time: $tm
echo Enter MJD : $MJD
echo Enter input file with abc var(~/) : $ifile
echo Enter input output file : $ofile
do
sed -e 's/a/$date/g' -e 's/b/$tm/g' -e 's/c/$MJD/g' $ifile > $ofile
done
However on running bash hi.sh in the terminal, the script is not working.
What is the issue and solution for this? I am new to scripting with bashrc