[Q] busybox throwing "precmd" errors after rooting ICS

1 posts
Thanks Meter: 0
By mdhobbes, Junior Member on 8th May 2012, 03:01 PM
Post Reply Email Thread

Thanks for looking at this post! I wanted to post it to the rooting thread, but I'm too much of a noob to have access to developer threads. I searched around (both here and google), but couldn't find any useful info on my problem.

I'll get right to the point. I rooted my Acer A500 (after doing an OTA update to 4.0.3), as per the instructions on this thread:

Everything seems to have worked well (I have root access, etc), but there is something quirky with Busybox. Every time I type a command in terminal (it doesn't matter which - I use both connectbot and terminal emulator), I get a "precmd: not found" message (even for simple things like directory changes). The odd thing is: the commands work, but I still get the message. For instance, if I ask for a directory listing, I'll get the listing, and at the end, it will say precmd: not found (usually with the name of the command it's referencing, e.g. bash: precmd: not found).

It seems to be looking for it in /system/xbin/bash, but bash is in /data/local; I tried creating a symlink but it didn't work ("link failed Cross-device link"). This is really a nuisance, and I'd like to try installing some linux user-land tools, but I fear the outcome might be disastrous if the busybox tools are misconfigured somehow.

I'd appreciate and help/suggestions. Many thanks.
29th August 2012, 10:14 AM |#2  
Junior Member
Thanks Meter: 1
Originally Posted by mdhobbes

"precmd: not found" message

Connectbot seems to set shell variable 'PS1' to "$(precmd)[email protected]$HOSTNAME:${PWD:-?} $ ".
It means your shell (the busybox's ash applet) will try to use output from 'precmd' as a part of a command prompt.
So when 'precmd' was not provided, error messages will be generated wenever a prompt was to be shown.

Though the messages should be safe to ignore, you may get rid of them by setting something harmless to PS1 like:
PS1="> "
, or reset PS1 by:
unset PS1
from your (busybox) shell.

# The same method should work for terminal emulator.
The Following User Says Thank You to hrkzmnm For This Useful Post: [ View ] Gift hrkzmnm Ad-Free
13th May 2013, 01:41 PM |#3  
Junior Member
Thanks Meter: 0
precmd is a shell function.

To display it run this from the default shell:
typeset -f
You will see something like
function precmd {
    typeset e=$?
    let " e " && print -n "$e|"
If you add that to one of your shell's startup files (".profile", ".bashrc", etc.) you will have a working precmd.
7th July 2013, 08:03 PM |#4  
Senior Member
Flag Warsaw
Thanks Meter: 302
It works (function runs), but shows nothing neither 0 or error code. What is it?


Nvm, my fault, figured it out
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