2008-11-21 03:46:46 GMT
Few days ago I've tried to do some scripting with the s3cmd.rb utility and I couldn't find a way to carry out the task because of the interactive nature of s3cmd.rb. I've made some search on the s3sync forum and finally found the solution:
yes | s3cmd.rb list mybucket | grep -v 'More? Y/n:'
I was surprised to find out that the "yes" utility is part of GNU Coreutils and I didn't know about it. I also find funny the hacky nature of the solution. It's not bulletproof because if your bucketname / keyname contains the "More? Y/n:" string then you're screwed, but that's a highly unlikely case and I admit that the above script should work in practice.
I was thinking on how command line applications could be standardized so they'd become more usable, less of a pain. Here are my suggestions:
I could probably come up with dozens like the above, but these are my initial thoughts.