SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: parsing errors

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    parsing errors

    Hello

    I have to execute exactly this linux command using shell_exec .

    find /test/ -type f -mtime +5 | awk '{print "rm \""$1" "$2" "$3"\" " }'


    but I receive always a parsing error . Any help please ?


    Thank you

  2. #2
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in other words using echo (which is the same to test)

    echo" find /test/ -type f -mtime +5 | awk '{print \"rm \"\"$1\" \"$2\" \"$3\"\"\" }' ";

    return this

    find /test/ -type f -mtime +5 | awk '{print "rm ""$1" "$2" "$3""" }'

    while I want return this

    find /test/ -type f -mtime +5 | awk '{print "rm \""$1" "$2" "$3"\"" }'

  3. #3
    SitePoint Wizard HarryR's Avatar
    Join Date
    Dec 2004
    Location
    London, UK
    Posts
    1,376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    May I suggest:

    Code:
    find /test/ -type f -mtime +5 -exec rm -f '{}' ';'

  4. #4
    SitePoint Member Dwarth's Avatar
    Join Date
    Apr 2003
    Location
    Montreal, Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this

    PHP Code:
    echo " find /test/ -type f -mtime +5 | awk '{print \"rm \\\"\"$1\" \"$2\" \"$3\"\\\"\" }' "

  5. #5
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks!


Bookmarks

Posting Permissions

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