I'm a beginner in bash scripting, and what I'm trying to is to build a script that is doing an API call to my enterprise system and returns the result to TXT file. In the end, I would like to read the output file that has been created by API. Unfortunately, it reads past file even if I'm removing it and I don't know why.
#!/bin/bash
#Clearing the history to check whether it helps or not
history -cw
#Defining variables
Scan_Output="Scan_output.txt"
Scan_Confirmation_Date=`awk 'NR==7' $Scan_Output` # reads line 7 from txt file
#Removing file if already exists
rm -f $Scan_Output
#API Request
curl "my piece of code" > $ScanOutput
sleep 5
echo $Scan_Confrimation_Date
awkcall to print line 7?