Large variable in bash script, is it wise?

Discussion in 'Programming' started by postcd, Nov 6, 2014.

  1. #1
    Hello,

    in my script i need to find newly added files added accross server HDD and check if they contains certain phrasses (30 phrasses)
    so i made something like following code, but i dont know if its wise that find command in variable (it can match like tens of thousand file paths..), or how would you do it better to be less performance hungry..? thank you

    for filepath in $(find /home ***);do
    for phrasse in $(cat phrasses);do
    grepout=$(grep ***)
    if [[ "$grepout" == *"some phrasse"* ]];then
    echo "phrasse found in $filepath"
    fi
    done
    done
    Code (markup):
     
    postcd, Nov 6, 2014 IP
  2. seductiveapps.com

    seductiveapps.com Active Member

    Messages:
    200
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #2
    your script is fine until it fails. probably won't.
     
    seductiveapps.com, Nov 16, 2014 IP