Hi, I'm trying to make a program that takes in one argument. A file. And then checks what has happened to the file 60 seconds later. To do this, I need to store the result from "-e $1" in a variable and then check it 60 seconds later. I can not seem to be able to make the if expression listen to me, and I know it's wrong. For testing purposes this script just prints out immediately the result of the comparison. Looking forward to a working sample of this, I don't know how many versions I've made of this tiny program. Thanks! It's due tomorrow, any help is very much appreciated!
#!/bin/bash
onStartup=$(test -e $1)
if [ -e "$1" ]; then
unixtid1=$(date +"%s" -r "$1") #To check if the file was edited.
echo $unixtid1
fi
sleep 3
#Here trying to be able to compare the boolean value stored in the
#start of the script. True/False or 1 or 0? Now, both is actually printed.
if [[ $onStartup=1 ]]; then
echo "Exists"
fi
if [[ $onStartup=0 ]]; then
echo "Does not exists"
fi