~jjo/bash-completion/fix-bash43-quote_readline_by_ref-tilde-and-double_escaping

« back to all changes in this revision

Viewing changes to bash_completion

  • Committer: JuanJo Ciarlante
  • Date: 2014-03-11 15:01:15 UTC
  • Revision ID: jjo@canonical.com-20140311150115-a6ilu34vueg7md1v
fix also lp# 1288031: avoid quoting if empty

Show diffs side-by-side

added added

removed removed

Lines of Context:
536
536
# @param $2  Name of variable to return result to
537
537
_quote_readline_by_ref()
538
538
{
539
 
    if [[ $1 == \'* ]]; then
 
539
    if [ -z "$1" ]; then
 
540
        # avoid quoting if empty
 
541
        printf -v $2 %s "$1"
 
542
    elif [[ $1 == \'* ]]; then
540
543
        # Leave out first character
541
544
        printf -v $2 %s "${1:1}"
542
545
    elif [[ $1 == ~* ]]; then