WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: bash script help needed  (Read 2491 times)

Offline PingPing

  • Jr. Member
  • **
  • Posts: 99
bash script help needed
« on: June 05, 2009, 04:31:43 AM »
I'm new bash scripting and need some advice.
I'm working on a remaster script that downloads a tce, extracts it and then consults a file ('remove_file_list') and removes files listed in that list.
The current script snippet is:
Code: [Select]
for FILE in `cat ../remove_file_list`
do
        rm -rf $FILE
done
I now want to amend the script so that I can insert comment lines (ie. all beginning with #) in remove_file_list and these lines will be ignored by the above script.

How do I do this?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: bash script help needed
« Reply #1 on: June 05, 2009, 05:44:19 AM »
`cat ../remove_file_list | grep -v '^#'`
The only barriers that can stop you are the ones you create yourself.

Offline PingPing

  • Jr. Member
  • **
  • Posts: 99
Re: bash script help needed
« Reply #2 on: June 05, 2009, 08:02:23 AM »
Duh!  **bangs head against wall**.
Thanks.