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

    Join Date
    Dec 2004
    Posts
    16
    Rep Power
    0

    Question Help with simple loop screens


    I have a bunch of files that begin with "man", which is then followed by numbers and possibly underscores. I need to make copies of all the files that begin with "woman" instead.

    I know this can be done with a simple for loop, but I can't get it working.

    Thanks for any help,
    gm
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,198
    Rep Power
    17
    #!/bin/sh
    for file in `ls man*`
    do
    [ -f wo$file ] && echo wo$file exists && continue
    cp $file wo$file
    done
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    16
    Rep Power
    0
    Thanks very much.

IMN logo majestic logo threadwatch logo seochat tools logo