Hi,
I would like to get the following script to work. The script should search for file that are bigger then 200 and that have been created or modified today!
The problem is the comparator == does not work! when i compare the ( $6 == $dat ) i don't get any output. when i change the $dat to "2010-02-06", i get the following output.
khalid@ubuntuFS:~/uppgift7$ ./uppgift17.sh /home/khalid/uppgift7/
/home/khalid/uppgift7/
2010-02-17
271k 2010-02-06 uppgift11.sh
270k 2010-02-06 uppgift14.sh
221k 2010-02-06 uppgift16.sh
288k 2010-02-06 uppgift17.sh
296k 2010-02-06 uppgift17.sh.save
264k 2010-02-06 file2
1526k 2010-02-06 file3
2010-02-17
khalid@ubuntuFS:~/uppgift7$
This is the script that i have a problem with.
#!/bin/bash
if [ -z $1 ]
then
echo "Enter a path: "
else [ -n $1 ]
path1=$1
echo $path1
dat=`date +%F`
echo $dat
file="$( ls $path1 -lR | awk '{if(( $5 > 200 ) && ( $6 == $dat ))print $5 "k\t" $6 "\t" $8 "\n\v\r"}')"
echo $file
fi
I know how to solve a problem with the command sed, i appreciate it if someone could tell me why the comparator is not working.
Thanks in advanced.