views:

23

answers:

1

Hey guys, I'm writing a simple script to autocomplete when I press TAB.

The php script contains a simple "echo".

In this case, the autocomplete works but a "tab" is appended to the output making it useless

Code from the script

scriptPath='/home/hassen/workspace/scripts/bin/test.php'

_dda()
{
    local cur
    COMPREPLY=()
    unset COMP_WORDS[0] #remove "j" from the array
    cur=${COMP_WORDS[*]}
    IFS=$'\n\n' read -d '' -a COMPREPLY < <($scriptPath --completion "$cur")
    return 0
}
complete -F _dda dda

alias dda=$scriptPath

Code from php script

<?php
echo "hello";
?>

Here is the annoying part: If I print the echo in Python or Ruby, it works like a charm -- ie each time I press TAB, it calls the scripts and output hello.

Is this a bug with PHP or my code? They seem to disagree at http://bugs.php.net/bug.php?id=52755

A: 

It works as desired here, are you very sure the PHP file itself doesn't hold a tab, possibly after the ?>?

Versions: PHP 5.3.2, GNU bash version 4.1.5

Wrikken
Yes I'm sure. I will try to upgrade. I'm running PHP 5.2.6Thanks for testing
hbt