Find the answer to your Linux question:
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    6

    Help with script


    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
    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.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,864
    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/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •