← Back to team overview

ubuntu-phone team mailing list archive

Re: Any tips on getting more usable terminal settings with 'adb shell'?

 

On Thu, Nov 7, 2013 at 10:23 AM, Alan Pope <alan.pope@xxxxxxxxxxxxx> wrote:
> On Thu, Nov 7, 2013 at 6:13 PM, Mike McCracken
> <mike.mccracken@xxxxxxxxxxxxx> wrote:
>> When I use 'adb shell', I get full-screen programs' (such as emacs and
>> multitail) output wrapped to a tiny size.
>> Also, long shell commands are wrapped but no newline is inserted, so I end
>> up typing over the beginning of the command.
>>
>> I'm hoping there's a simple fix that someone with more term config
>> experience can offer up.
>
> http://superuser.com/questions/350817/how-to-set-terminal-size-in-android-adb-shell
>
> stty rows 60 cols 156

You can determine the size of your terminal programmatically like so:

$ tput lines
64
$ tput cols
112

But I'm having difficulty communicating that information down into the
adb shell (you have to run tput on the host to get the right values;
if you run it within adb shell you just get 80x24). I was hoping
something easy would work:

$ adb shell stty rows $(tput lines) cols $(tput cols)

But unfortunately the stty call didn't 'stick' when I called `adb
shell` afterwards. Then I thought we could shoehorn in a bash
invocation after the stty call, like so:

$ adb shell stty rows $(tput lines) cols $(tput cols) \; bash

That does get us a prompt with the right size terminal, but it doesn't
seem to be responsive (can't get any output from commands). I also
tried:

$ adb shell bash -c "stty rows $(tput lines) cols $(tput cols)" -l

But it just returns immediately without giving us a prompt on the
device. So for now it seems you have to call tput in the host, then
adb shell, then call stty and manually type in the numbers in. Anybody
have any other ideas to automate this?


References