Thread: Curious PHP cli output in context of bash completion ?
hello,
i'm not sure right forum give try , please forgive me english mistakes...
why ubuntu forum , not php or bash forum ?
because now, problem occured on ubuntu 8.04 , ubuntu 9.10. worked fine under ubuntu dapper , works fine under mac os x, using php-5.3.1 , bash-3.2.48 macport.
firstly searched php options not find , i'm not able understand problem source.
here's thing :
have php script "bash completed" using output of php script. when asking bash completion, have curious newline characters seems not captured bash , completion fails.
please find bellow source of files reproduce problem :
- "completion.sh" : bash script declares completion "myscript.php", using "echoscript.php" or "echoscript.sh", depending of comment in source code. (in real case, "myscript.php" used self-completion)
- "myscript.php" : php script echo "hello world"
- "echoscript.php" : simple php script outputs "a b c d", without new line
- "echoscript.sh" : bash version of echoscript.php
using echoscript.sh completion, works. using echoscript.php, makes "something" ...:
type : "./myscript.php<tab><tab><tab><enter>" , see :
can understand problem ?! great appreciate help.code:alex@sd-7354:~/completion$ ./myscript.php b c d alex@sd-7354:~/completion$ ./myscript.php b c d alex@sd-7354:~/completion$ ./myscript.php hello world alex@sd-7354:~/completion$
thank you.
n.b. : not forget permissions (chmod +x myscript.php echoscript.php echoscript.sh) , path (path=.:${path}) run example.
== source of completion.sh ==
== source of echoscript.sh ==code:#!/bin/bash _completemyscript() { local cur cmds cmdopts cur="${comp_words[comp_cword]}" # not work... #compreply=( $( compgen -w "$(echoscript.php)" -- "${cur}" ) ) # works compreply=( $( compgen -w "$(echoscript.sh)" -- "${cur}" ) ) return 0 } complete -f _completemyscript -o "default" myscript.php
== source of echoscript.php ==code:#!/bin/bash echo -n "a b c d"
== source of myscript.php ==code:#!/usr/bin/php <?php echo "a b c d";
--code:#!/usr/bin/php <?php echo "hello world\n";
alex
ok. did recompilation of php-5.2.4 source (http://museum.php.net/php5/php-5.2.4.tar.bz2) under ubuntu-8.04, used php cli obtained , works.
here's configure used :
i didn't applied same patchs or did not used same compilation options distribution did ; i'm not guru of compilation , php compilation ...code:./configure --with-mysql --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-gd --with-curl --with-curlwrappers --enable-exif --with-xsl --with-zlib --without-pear --enable-mbstring --enable-pcntl --prefix=/usr/local/php
have idea part source of problem ? should submit bug ?
thank you.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Curious PHP cli output in context of bash completion ?
Ubuntu
Comments
Post a Comment