Q: at command force script not to read from text file I have a script with the name  bckp2 and a text file with the name variables.txt. When I am running the script like that in the terminal ./bckp2 it works exactly as I want, but when I try to run it with the at like this at -f bckp2 19:30 it doesn't work, it doesn't do the same thing. With the at command it seems like it doesn't read from the file and I have no idea why.
script bckp2 Reads 3 words from the text file variables.txt and is using them as source and destination for tar command. Just ignore the first word it's for testing
let count=0

while read line; do
 for word in $line; do
  if [ $count -eq 0 ]
   then
     username=$word
  elif [ $count -eq 1 ]
   then
     source=$word
  elif [ $count -eq 2 ]
   then
     destination=$word
  fi
  let count=count+1
 done
done < variables.txt

echo $destination $source  > test.txt
tar -cvf $destination.tar $source

Text file variables.txt
valkon fake faketar

In the script bckp2 I am saving the file content into variables, only to see if the at works or not, and it doesn't. It's writing to file blank text, so I assume that the script doesn't read from file at all. But as I told you, when I am running it like ./bckp2 it works.

A: at and batch default to interpreting commands with /bin/sh, not /bin/bash. If you want to use a different shell, you need to format your script appropriately, by adding #!/bin/bash as the first line of the script.
Also, your unnecessarily complicated loop for reading variables could be simply replaced with
read username source destination < variables.txt

