On Wed, Mar 4, 2009 at 4:56 AM, Xavier Gomes Pinho <a52...@alunos.uminho.pt> wrote: > > Hi! > > Since i was told [0] that 'DescribeProgram' wasn't being maintained and > you were accepting improvements, i decided to give it a try. > > I rewrote it in Bash and now it uses R/Description files instead of > /F/Descriptions/* > > Here it is: http://www.alunos.di.uminho.pt/~a52363/DescribeProgram Thanks, it looks promising, but there are some issues: + searchpath=( + "${searchpa...@]}" + '`FindPackage -ti '$program'`/Resources/Description' + '`GetRecipe -W '$program'`/Resources/Description' + ) This doesn't work. It sets the paths as (literally) "`FindPackage -ti Scripts`/Resources/Description". + searchpath=( + "${searchpa...@]}" + '`GetRecipe '$program'`/Resources/Description' + ) Same problem. + sourcefile=$(eval "echo $sourcefile") I have no idea what this is for. + description=$(cat $sourcefile) Firstly, you should always quote variables with unknown contents when you use them. Secondly, this is only really used for testing if it's empty, so just use -s instead. + # Extract all the words from description. + wordsarray=($description) + Log_Debug "Words: ${wordsarr...@]}" >From here and on is an interesting approach. I would have used read instead of catting the file into an array, which is likely to be problem-fraught. + if [ $(GetRecipe -W $program) ] This is unsafe if GetRecipe returns more than one shell word. + # Conclusion: Reason 2, Scenario #1. + reasonwhy="Can't find anything about '$program'. Does a recipe exists?" It should be "Does a recipe exist?", but I don't think asking a question is the right interface here. This whole diagnosis area of the code is unnecessarily verbose too.
As a general comment, we don't usually fill the scripts with "declare" statements, and there aren't extra blank lines scattered everywhere at random either. Take a look at some of the other shell scripts for guidance, and <http://gobo.kundor.org/wiki/Shell_Scripting_Coding_Style> too although it's a bit incomplete. As well, a script that had been tested and worked would have a better chance of acceptance and be useful. If you can fix those issues I think we can go somewhere with this. Andrew, if you're relying on DescribeProgram you shouldn't be. The descriptions it uses are no longer updated and haven't been since June 2005, so it's not at all useful. -Michael _______________________________________________ gobolinux-devel mailing list gobolinux-devel@lists.gobolinux.org http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel