Problem with a variable withing a variable

hello there,

basically im screwed with a variable that should take the last modification date of a file.
my code is

fileCreationTime=$(( `ls -l $fileName | tr -s " " | cut -d " " -f6` ))

my problem arise coz when the code is executed and stored in a file the return value is 1993 and not the real date. When i execute the ls comand with all the addons alone in the console it works perfectly....

anyone knows why the code doesnt work or any other way of getting the last mod date of a file and putting it into a variable??

i would really appreciate ur help
thx:wall:

Can you show us?

ls -ld $filename | awk '{print $6 " " $7" "$8}' $8 can be either a year or the time of day depending on the age fof the file however.

Perhaps you need to stat the file

Ah I see Skrynesaver had the same opinion: In any case it could not have been -f6

Perhaps he is using gnu ls, in which case f6 may be the year/date of whatever, different implementation of ls.

Please post a sample output from ls here.

In addition, get rid of the doube "((" 's, just use a single "( )" and get rid of backticks as well like this: