Amir Tahvildaran on 25 Jul 2012 07:35:56 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] php pipe to less broken? |
-----BEGIN PGP SIGNED MESSAGE-----If you're not getting odd characters and you still get the malfunction
Hash: SHA1
with less then I'm out of ideas!
Perhaps it has to do with reading stdout?
What happens if you redirect your output to a file and then use less?
Eric
On 07/19/2012 04:43 PM, Amir Tahvildaran wrote:
> Thanks Eric, good idea.
>
> I tried this on my simplified script (which just prints out 10 numbers).
>
> Doesn't seem to have any magic chars.
>
> 0$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ (END) jkjk
>
>
>
> $ cat test.php <?php
>
> for ($i = 0; $i<10; $i++){ echo $i . "\n"; }
>
> ?>
>
> -Amir
>
>
>
>
iEYEARECAAYFAlAKp+4ACgkQ2sGpvXQrZ/7zMQCg7EY59GefHEPdGFJeHZTBraPx> On Thu, Jul 19, 2012 at 2:26 PM, Eric at Lucii.org <eric@lucii.org <mailto:eric@lucii.org>> wrote:
>
> Amir:
>
> Maybe some control characters could be in the output stream?
>
> Instead of less try piping your output through | cat -vet
>
> This will show the EOL as $ and a carriage return as ^M Other control characters in a similar way: (BEL = ^G, etc.)
>
> Hope that helps.
>
> Eric
>
>
> On 07/19/2012 01:46 PM, Amir Tahvildaran wrote:
>> Not sure what's going on here. On a CentOS 6.2 vm when I pipe php output to less I wind up in some weird mode where "j" and "k" don't move up and down, instead they just queue up at this colon prompt.
>
>> :jkjk
>
>> If I hit enter after it sort of goes up/down by a line. If I hit gg or G and then enter I get to the top or bottom of the file. Similarly 'q<enter>' get's me out of it.
>
>> Is anyone familiar with this mode of less? Same thing happens for more. Same thing happens if I throw tee in the middle (and I can less the tee'd file normally afterwards too).
>
>> It seems to only be for PHP output, if I cat a file to less it works as expected. If I write a bash script it also works as expected. I tried getting php to exit(0) or exit(1). The php script runs and exits as normal (AFAIK) without the pipe.
>
>> Any thoughts?
>
>> -Amir
>
>> $ php -version PHP 5.3.3 (cli) (built: Jul 3 2012 16:40:30)
>
>
>> ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
>
>
> ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
>
>
>
>
> ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
>
- --
# Eric Lucas
#
# "Oh, I have slipped the surly bond of earth
# And danced the skies on laughter-silvered wings...
# -- John Gillespie Magee Jr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
KnoAn1BDVciEJVFU7xJpsrApddi0lN2B
=p2iC
-----END PGP SIGNATURE-----
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug