![]() |
Scripting with the Nokia 770
Hi,
I would like to know the following things : - as being a standard Nokia 770 user, I have seen that the default shell (see /etc/passwd) for the user (called user) is /bin/sh. As far as I remember this means 'Bourne Shell'. So I start playing with Bourne Shell. Two questions : - howto add extra directory locations to the environment variable PATH (that stays there too after reboot) with the OS 2006 ? - howto install / configure bash so I could start real bash scripting ? Cheers, Jan On the Nokia 770 OS 2005 I remember I started with some scripting (based on the information posted on the wiki about using xterm). However, how to do it on the OS 2006 ? Currently vi is standard available in the OS 2006. Which steps has to be taken in order to start scripting ? Cheers, Jan |
I'm not an expert, but here is a simpe way to get started, others may improve on it :
First, when you open xterm, you are user "user", but you are not properly logged, ie what a normal "login" does has not been executed (not in home dir, etc.). The first thing I do is type (or recall) : sh --login Now I am in /home/user Here you can create a file name .profile (note the dot). In there you can add to the path : PATH=$PATH:/some/dir and define your aliases : alias l='ls -l' etc. This file is executed in a proper login so you don't have to do it again. You can do the same in /home/root for when you "sudo su -". You can install bash using the app manager and use that instead. To recap : when I arrive in xterm I use the arrow keys to recall sh --login. In that new shell I have my environment until I type exit. Then I'm back to the original where I type exit again to close xterm. So in that first shell I only ever have those two commands in the history, and just use two keys to recall them. Very basic, but it works :-) |
Hi,
Thanks for the detailed explanation. Indeed it works ! The question now is, how could the : sh --login be automated ? Concerning bash packet, I couldn't find it for the OS2006. Anybody knows where to find ? Your remark : You can do the same in /home/root for when you "sudo su -", I don't get it :-(. Cheers, Jan |
Quote:
Quote:
Quote:
|
bash
You can find bash on this list:
http://maemo.org/maemowiki/ApplicationCatalog2006Wip |
My user .profile contains one line:
export ENV=$HOME/.shrc and my .shrc file is as follows: Code:
export VISUAL=/bin/vim Xterm will look for a variable called ENV and if it points to an executable script, it will run it. This also works when I ssh in. Root's home is /root not /home/root My root's .profile references a .bashrc file. I ALWAYS use sudo su - to gain root. |
BanditRider, thanks a lot for that explanation ! I didn't about xterm and the ENV variable, this makes it all smooth and automatic like janjansenbe wanted... of course I'm going to switch over too :-)
Sorry about the /root typo -- that's what you get for typing from memory because you're too lazy to whip out the tablet and check :) |
Hi BanditRider and fpp,
I try to follow the tips but after changing the .profile and .shrc files, after booting (powerof / poweron ?), ... on my system, still the sh --login is required to make the aliases active. What could be wrong ? By the way, the VISUAL and umask aren't clear for me. Cheers, Jan |
I just tried this but can't get it work. After two reboots my xterm is still the same as before, no ENV var and no script executed. Is that export really in /home/user/.profile or maybe /etc/profile ?
|
These files are in /home/user
Make sure your .profile and .shrc are executable. chmod +x .profile chmod +x .shrc reboot (power off and on or use the reboot command as root) |
All times are GMT. The time now is 21:57. |
vBulletin® Version 3.8.8