Results 1 to 2 of 2
Code:
#!/bin/bash
echo type first file name
read x
echo type second file name
read y
a=$(stat -c%s $x)
b=$(stat -c%s $y)
if '[' "$a" -gt "$b" ']'
then
echo ...
- 09-24-2011 #1Just Joined!
- Join Date
- Sep 2011
- Posts
- 6
Help with script
This is script which compares file sizes and shows which is bigger. The question is. How i can make script search for files in whole hard disk not only in directory in which i work.Code:#!/bin/bash echo type first file name read x echo type second file name read y a=$(stat -c%s $x) b=$(stat -c%s $y) if '[' "$a" -gt "$b" ']' then echo "File $x larger " elif '[' "$b" -gt "$a" ']' then echo "File $y larger " else echo "Both files are equal" fi
- 09-24-2011 #2
Sorry, but as you've already had pointed out to you, homework questions are not allowed. You perhaps want to take a look at the man page for the 'find' command, or ask your tutor.
Linux user #126863 - see http://linuxcounter.net/


