clacker


Group: Members
Posts: 570
Joined: June 2004 |
 |
Posted: May 01 2005,21:06 |
 |
WoofyDugFock, I was really impressed by your code. I learned a lot from the simplicity of your use of && and ||, as well as being able to use |'s rather than /'s in sed. I didn't know that. Having the error displayed after the procedure was really an eye opener for me. I know I'll be doing that myself in the future. I got duplicates when I tried your code though. When I had the same files selected, I got multiple entries in filetool.lst when I hit the button multiple times.
If join works eliminating duplicates, then what was the problem with a duplicated filetool.lst? Why should you need the extra sed statements? Do all files get duplicated?
I went back to sort and uniq to change your code to:
Code Sample | a=~/filetool.lst && echo "Backup list:" && for i in %f; do echo %d/$i |sed "s/^\/\(ramdisk\)*\/*//" >> $a; done && cat $a | sort | uniq | tee $a && echo "Done." || echo "Error" |
I didn't get duplicates, and filetool.lst wasn't repeated either.
The raw example is great: it's like a little microcosm of bash wonders.
|