diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2009-04-14 21:38:03 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2009-04-14 21:38:03 +0300 |
commit | 80db1412cd2c8f42cc38cff4851b05998d2d5a7e (patch) | |
tree | be6be0d63e6ebb213b6b6894b94500e4d81d383d /README | |
parent | 95cd673b5cbd5658cbf56a56a4113722aab92177 (diff) | |
download | bash-completion-80db1412cd2c8f42cc38cff4851b05998d2d5a7e.tar.gz |
Add note about compgen -- $cur vs embedding $cur in external command arguments.
Diffstat (limited to 'README')
-rw-r--r-- | README | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -450,6 +450,16 @@ guidelines in mind: These forms of parameter substitutions can also be used on arrays, which makes them very powerful (if a little slow). +- Prefer "compgen -W '...' -- $cur" over embedding $cur in external + command arguments (often e.g. sed, grep etc) unless there's a good + reason to embed it. Embedding user input in command lines can + result in syntax errors and other undesired behavior, or messy + quoting requirements when the input contains unusual characters. + Good reasons for embedding include functionality (if the thing + does not sanely work otherwise) or performance (if it makes a big + difference in speed), but all embedding cases should be documented + with rationale in comments in the code. + - Do not write to the file-system under any circumstances. This can create race conditions, is inefficient, violates the principle of least surprise and lacks robustness. |