Go Back   xda-developers > Dream > Dream android development

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17th July 2009, 10:13 PM
mzet mzet is offline
Member
 
Join Date: Mar 2008
Posts: 37
Default shell bash for android

hi,
i compiled bash and added support for executing file /sdcard/bash_profile, so you can set PATH and PS1 variables there, for example...

if someone is interested, there it is for download
http://pub.mzet.net/bash

for become default shell copy bash to /system/bin/bash a then run:
Code:
cd /system/bin
chmod 0755 bash
mv sh sh0
ln -s bash sh
Reply With Quote
Sponsored Links

  #2  
Old 17th July 2009, 10:21 PM
shafty023 shafty023 is offline
Senior Member
 
Join Date: Jul 2007
Location: Austin,TX
Posts: 575
Default

Quote:
Originally Posted by mzet View Post
hi,
i compiled bash and added support for executing file /sdcard/bash_profile, so you can set PATH and PS1 variables there, for example...

if someone is interested, there it is for download
http://pub.mzet.net/bash

for become default shell copy bash to /system/bin/bash a then run:
Code:
cd /system/bin
chmod 0755 bash
mv sh sh0
ln -s bash sh
NICE! Good job mzet. I missed bash and its wonderful auto complete. This should help spur better scripting with all the functionality that bash supports. No more semicolons at the end of each line in a shell script.
__________________
-He who laughs last didn't tell the joke

Qualifications
Bachelors Degree in Computer Science & Math
Unix System Administrator
Software/Web Developer - Java/C/C++/Intel Assembly/Lisp/Php/Javascript/Html/Jquery/Ajax/Json/Xml/CSS

If you like what I do, please consider --> DONATING <-- to my efforts
You can also follow me on TWITTER for the latest updates or ask questions there
Reply With Quote

  #3  
Old 17th July 2009, 10:23 PM
shafty023 shafty023 is offline
Senior Member
 
Join Date: Jul 2007
Location: Austin,TX
Posts: 575
Default

On a side note, we should be able to add the following to init.rc rather than symlinking sh -> bash

export SHELL /system/bin/bash
__________________
-He who laughs last didn't tell the joke

Qualifications
Bachelors Degree in Computer Science & Math
Unix System Administrator
Software/Web Developer - Java/C/C++/Intel Assembly/Lisp/Php/Javascript/Html/Jquery/Ajax/Json/Xml/CSS

If you like what I do, please consider --> DONATING <-- to my efforts
You can also follow me on TWITTER for the latest updates or ask questions there
Reply With Quote

  #4  
Old 17th July 2009, 10:28 PM
mzet mzet is offline
Member
 
Join Date: Mar 2008
Posts: 37
Default

here is example of my /sdcard/bash_profile
Code:
PATH=/sbin:/system/xbin/bb:/system/xbin:/system/bin
if [[ ${EUID} == 0 ]] ; then
  PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
  PS1='\[\033[01;32m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
it shows localhost in green color when user is logged or in red color when root is logged...
Reply With Quote

  #5  
Old 17th July 2009, 10:30 PM
mzet mzet is offline
Member
 
Join Date: Mar 2008
Posts: 37
Default

Quote:
Originally Posted by shafty023 View Post
On a side note, we should be able to add the following to init.rc rather than symlinking sh -> bash

export SHELL /system/bin/bash
strange. is this variable used? when i execute "echo $SHELL" it writes "/bin/sh", but it does not exists, it should write /system/bin/sh, i think
Reply With Quote

  #6  
Old 17th July 2009, 10:42 PM
DeToX-cz's Avatar
DeToX-cz DeToX-cz is offline
Senior Member
 
Join Date: May 2008
Location: Breclav
Posts: 131
Default

"/bin/sh" is ok. It's in boot.img...(respectively in ramdisk). Check out some ramdisk
__________________
Follow me on twitter @detoxcz
If you like my work, feel free to buy me some donut-s
Reply With Quote

  #7  
Old 17th July 2009, 10:43 PM
shafty023 shafty023 is offline
Senior Member
 
Join Date: Jul 2007
Location: Austin,TX
Posts: 575
Default

Quote:
Originally Posted by mzet View Post
strange. is this variable used? when i execute "echo $SHELL" it writes "/bin/sh", but it does not exists, it should write /system/bin/sh, i think
Ya I noticed that after posting my last message. Perhaps it's not used. I'll try and find some time to change that in init.rc and reboot to see if it takes effect
__________________
-He who laughs last didn't tell the joke

Qualifications
Bachelors Degree in Computer Science & Math
Unix System Administrator
Software/Web Developer - Java/C/C++/Intel Assembly/Lisp/Php/Javascript/Html/Jquery/Ajax/Json/Xml/CSS

If you like what I do, please consider --> DONATING <-- to my efforts
You can also follow me on TWITTER for the latest updates or ask questions there
Reply With Quote

  #8  
Old 17th July 2009, 10:55 PM
overground's Avatar
overground overground is offline
Senior Member
 
Join Date: Apr 2009
Location: Oxnard, CA
Posts: 627
Default

Quote:
Originally Posted by shafty023 View Post
Ya I noticed that after posting my last message. Perhaps it's not used. I'll try and find some time to change that in init.rc and reboot to see if it takes effect
I tried adding that to my init.rc and not doing the symlink and lost my shell, which I expected. I figured a reboot would fix it, but got stuck @ boot image. No problem...recent nandroid.

EDIT: Using the symlink works fine for now. Thank you!
__________________
T-mobile G1 (bronze) Rooted / ROM: This and That...Here and There / Radio v.2.22.19.26I / HBOOT-1.33.2005 / 8GB class 6 SD card
Recovery:
RA-dream-v1.3.2_BKMOd_1 / LIKE SWITCHROM? YOU'LL LOVE BART-thanks devsk & dumfuq!! / Rogro82's and Irrenhaus' modified Launcher / GDE=360°s of fun!!
Quote:
Originally Posted by dumfuq View Post
That is correct. Or you cold use the escape sequence instead of quotes.
Code:
sh /system/sd/bart.sh Double\ post -d -u -m -f -u -q knockeduphooker9.1.1Full10-26-09
Buy me some meds

Last edited by overground; 17th July 2009 at 11:53 PM..
Reply With Quote

  #9  
Old 17th July 2009, 11:27 PM
ttabbal ttabbal is offline
Senior Member
 
Join Date: Jul 2009
Posts: 165
Default

Very cool. Thanks for giving us bash for Andriod! While we're thinking of low level tools, anyone have a version of busybox with colorized 'ls'?

Anyone know when /system/sd is mounted in the cyano ROMs? If it's available early enough, we could copy bash to /system/sd and avoid taking up 2.5MB in /system/bin.

Last edited by ttabbal; 18th July 2009 at 12:11 AM..
Reply With Quote

  #10  
Old 18th July 2009, 12:50 AM
mzet mzet is offline
Member
 
Join Date: Mar 2008
Posts: 37
Default

it's too big, because everything is built statically
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:45 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.