From: Mikael A. <sn...@te...> - 2003-08-01 00:51:29
|
Here is a small patch (attached) that adds wildcard matching for the V command. Also it fixes what i feel is a bug with V in that it also reports all functions in the scope. I'm not a seasoned bash scripter so there are probably some things that can be fixed. But for now it seems to be quite robust. A few intersting points to consider. I chose to call declare -p <var> for each var to be able to weed out any false positives the previous functions could have let through. For example the function: strange() { echo "This is an } odd=but still legal construct" } could fool the code unless declare -p was called on the name odd. declare -p will only put a closing bracket at the far right if it's part of a string. And thus the function detection will work well for all cases except those but they should be quite rare and if they occur the declare -p disqualifies them. You could get a variable output several times in extreme cases. But i'm not sure those few cases warrant adding some code to ensure each variable is printed only once since it will slow down the variable listing additionally. /regards Mikael Andersson |