how to include the commands of envsetup.sh in Android?

garima picture garima · Apr 13, 2011 · Viewed 7.8k times · Source

Hi I have run the command ./build/envsetup.sh on my source code of android while compiling. I want to use the following commands present in the same file. -cgrep -mmm -mm

but I get the following errors!!

 Command 'pgrep' from package 'procps' (main)
 Command 'fgrep' from package 'grep' (main)
 Command 'egrep' from package 'grep' (main)
 Command 'sgrep' from package 'sgrep' (universe)
 Command 'grep' from package 'grep' (main)
 Command 'lgrep' from package 'lv' (universe)
 Command 'rgrep' from package 'grep' (main)
 Command 'zgrep' from package 'gzip' (main)
 Command 'dgrep' from package 'debian-goodies' (main)
 Command 'vgrep' from package 'atfs' (universe)
 Command 'ngrep' from package 'ngrep' (universe)
 Command 'wcgrep' from package 'kdesdk-scripts' (main)
 Command 'agrep' from package 'agrep' (multiverse)
 Command 'xgrep' from package 'xgrep' (universe)
 cgrep: command not found

How should I resolve this? Do I need to make any changes in the envsetup.sh file?

Answer

Nic Strong picture Nic Strong · Apr 13, 2011

The mm, mmm and cgrep are defined as shell functions. What does the following return for you:

set | egrep "^mmm \(\)|^mm \(\)|^cgrep \(\)"

On my environment I get:

cgrep ()
mm ()
mmm ()

If you are getting nothing back, you are probably sourcing the script wrong. Remember you can't just make the script executable and run it as it won't be exporting the functions back to your shell. You must use either:

. build/envsetup.sh

OR

source build/envsetup.sh

to ensure it runs in parent shell.