Reply
Thread Tools
Posts: 57 | Thanked: 5 times | Joined on Nov 2005 @ Belgium
#1
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
 
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#2
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 :-)
 

The Following User Says Thank You to fpp For This Useful Post:
Posts: 57 | Thanked: 5 times | Joined on Nov 2005 @ Belgium
#3
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
 
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#4
Originally Posted by janjansenbe
Hi,
Thanks for the detailed explanation. Indeed it works !
The question now is, how could the : sh --login be automated ?
I don't know - but maybe just a keypress each time is not worth automating :-)
Concerning bash packet, I couldn't find it for the OS2006. Anybody knows where to find ?
You are right, it's not there. I'm sure I saw it somewhere though, but can't remember...
Your remark : You can do the same in /home/root for when you "sudo su -", I don't get it :-(.
I meant making a .profile in /home/root too, so that when you do "sudo su -" to become root, you still have your paths alilas etc...
 
Posts: 19 | Thanked: 1 time | Joined on Jul 2006
#5
 
Posts: 264 | Thanked: 28 times | Joined on May 2006
#6
My user .profile contains one line:

export ENV=$HOME/.shrc


and my .shrc file is as follows:
Code:
export VISUAL=/bin/vim
umask 022
export PATH=$PATH:~/bin

#
alias ll='ls -l'
alias l='ls -lA'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

cd $HOME
The .profile is executed when the 770 boots but not when you open an xterm session.
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.
 

The Following User Says Thank You to BanditRider For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#7
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
 
Posts: 57 | Thanked: 5 times | Joined on Nov 2005 @ Belgium
#8
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
 
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#9
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 ?

Last edited by fpp; 2006-08-04 at 22:10.
 
Posts: 264 | Thanked: 28 times | Joined on May 2006
#10
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)
 
Reply


 
Forum Jump


All times are GMT. The time now is 21:58.