Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Quick help needed with a Bash script...

Options
  • 07-05-2005 2:07pm
    #1
    Closed Accounts Posts: 4,763 ✭✭✭


    I want to make a batch mover for files, along these lines, for updating my config files in Gentoo after a big emerge, after doing a find for them.
    mv /etc/.crap.<filename> /etc/<filename>
    

    I've no problems with a small script to to find all the files that need updating, but how can I direct it to search for files based on one part of its name and then alter them based on another part?


Comments

  • Registered Users Posts: 724 ✭✭✭Dero


    cd /etc
    for i in .crap.*
    do
    mv $i ${i##.crap.}
    done
    

    Edit: Also, read this. Very useful reference.


  • Closed Accounts Posts: 4,763 ✭✭✭Fenster


    Thanks for the link, some nice reading there, even if it is a wee bit too big to be all printed out :(


Advertisement