Remove All Ads from XDA
Honor 9 Lite

busybox & Windows command prompt & colors & ls

919 posts
Thanks Meter: 11
By jmanley69, Senior Member on 11th November 2009, 04:18 AM
Post Reply Email Thread
ok... so, I've loaded my custom ROM and it contains busybox... I do like the extra functions that busybox offers over the stock Android "toolbox", so I don't really want to disable the commands like ls... I'd just like to turn the colors off.

Here's what I've found in my researches...

1) I can always
ls --color=never
but that is a lot of extra typing that I'm just not willing to do.

2) I can now SSH into my phone with putty and the colors are nice... but if I'm doing this over the cell modem (even EVDO), it's not too responsive (probably has some to do with currently running applications, syncs, and so forth)

3) I can use Droid Explorer and open a command shell from there, and the colors are nice... but Droid Explorer takes a lot longer to load than adb shell and the nice thing about being at my command prompt is if I need to push, pull, or remount (I understand I can always manually remount,rw and remount,ro from any shell, but adb makes it really easy to do with less typing) quickly... I can exit out of the shell, do the command, and go right back into the shell.

4) I can use Better Terminal Emulator on the phone... again... colors nice (I think you're seeing a theme here) but the typing is excruciating for long commands, and God forbid you make 1 typo... for quick things it's cool and to do a command while not at my computer, it's great.

5) If I were running Windows 95 (or maybe even XP), I could just use ansi.sys and do it. However, I've found that the only way ansi.sys works in a command prompt is to use COMMAND.COM and not CMD... plus you have to set CONFIG.NT to "dosonly" mode and include the driver in there... the biggest problem with all that is that adb will NOT run in DOS only mode. I even tried to adb shell from within a Cygwin command prompt (that already has colors enabled) but all the ansi color codes were lost.

So.... Here's my dilemma... I want colors when I'm not coming in through the Windows command prompt and adb shell. However, I want to disable the colors when I'm coming in through adb shell. I would probably settle for a different way to shell in from Windows 7 than the ones listed above.

I think I remember from my freshman year of college when they tried to teach me Unix, that you can set "default" command line switches for applications. For example, if you always wanted ls to do -l, then someplace you could set that as a default. I read on another post (possibly another forum) that somebody suggested editing .profile to do an alias of a command... something like
alias dir='ls --color=never'
but the problem with that is there's no .profile and there's no home directory for root or shell.

I even read that the standard ls uses an environment variable LS_OPTIONS, but I don't think that the stock Android ls uses it, and I can't get busybox to use it - plus, it'd be a pain to type that in every time I do an adb shell.

Does anybody have any suggestions or tips or any way to do this? If the alias will work, I'd be happy with that. I could then set dir to no color and keep ls with color. I could maybe even remap a command to do a ls -l all the time.

Thanks in advance.
22nd May 2011, 10:04 AM |#2  
spiicytuna's Avatar
Senior Member
Flag SF/Bay Area
Thanks Meter: 229
Donate to Me
This was what I ended up doing under Windows 7:
23rd June 2011, 05:41 PM |#3  
Junior Member
Thanks Meter: 5
This works for me:

export LS_COLORS=none
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes