I have a snippet of code that works when used in its own .sh file:
#! /bin/bash
LastFileUpdate=`find $dir -name $SearchString -type f -printf '%T@ %p\n' | sort -n | tail -n 1| awk '{print $1}'`
echo $LastFileUpdate
This code works on its own, but when I insert it into another .sh script, it doesn't return anything! The variables are not used anywhere else. What could cause this?
let "Diff = $SystemTime - $LastFileUpdate"
This returns " let: Diff = 1111111 - : syntax error: operand expected(expected token is " ")
This implies the variable LastFileUpdate never even gets populated by the expression, which is wierd, because it works on it its own.
Ideas?