Thread: Getting Error

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    7
    Rep Power
    0

    Unhappy Getting Error


    Hi,

    I have a configuration file name (tar_config1.sh)which has the following enteries ....


    10 /home/admin/files /home/admin/output
    here
    10 represents days(mofification time),
    /home/admin/files represents source folder from where the files will be picked up
    /home/admin/output represents whwre the files will be kept so it is a sort of destination


    I was planning to move files as per the modification time (10 days) from the source folder(files) location to the destination (output),I want my main script file should read my this configuration file(tar_config1.sh) and take parameters from thaT

    I have written main script file name main1.sh which will read this configuration file ...


    Code:
    #!/bin/sh
    while read DAYS INDIR OUTDIR
    do
    find $INDIR -type f "!" -mtime $DAYS -exec mv {} $OUTDIR \;
    done </home/Administrator/scripts/tar_config_file1.sh
    Now upon executing main1.sh, I get the error that

    main1.sh syntax error near unexpected token 'done'.please guide me how to corret this problem
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,448
    Rep Power
    1751
    Don't have a loop - you really don't need it here, try:

    Code:
    cat /home/Administrator/scripts/tar_config_file1.sh | read DAYS INDIR OUTDIR
    find $INDIR -type f "!" -mtime $DAYS -exec mv {} $OUTDIR \;
    Out of curiosity - what is the "!" supposed to be doing?
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo