maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   How to make aliases ? (https://talk.maemo.org/showthread.php?t=38524)

choubbi 2009-12-27 00:13

How to make aliases ?
 
Hi,

I'm a beginner in command line and I'm a bit lost with Maemo's shell : I'd like to create basic aliases for my N900 (alias ll = 'ls -l', that kind of stuff).
Apparently the default shell doesn't have a .bashrc, so I don't know where to put my aliases.
How to apply the changes afterwards, too ? (sounds like there isn't "source" either)

Thanks

j.s 2009-12-27 00:30

Re: How to make aliases ?
 
Quote:

Originally Posted by choubbi (Post 442565)
Hi,

I'm a beginner in command line and I'm a bit lost with Maemo's shell : I'd like to create basic aliases for my N900 (alias ll = 'ls -l', that kind of stuff).
Apparently the default shell doesn't have a .bashrc, so I don't know where to put my aliases.
How to apply the changes afterwards, too ? (sounds like there isn't "source" either)

Thanks

The n900 does not come with bash, but with a much simpler sh compatible shell.

In a terminal, type:
Code:

echo 'alias ll="ls -l"' > /home/user/.profile
You can then type:
Code:

source /home/user/.profile
The source will work. I don't know what your problem was. From then on, opening a new terminal will atomatically read the commands in .profile and the source command not needed.

choubbi 2009-12-27 00:42

Re: How to make aliases ?
 
Thanks, it works !
I had found a thread in which it was told .profile was supposed to be an equivalent to .bashrc (I wasn't sure it worked for aliases though), but I couldn't source it with "source .profile". "source /home/user/.profile" works though, I guess it was just the path that was required (I just tested with ./.profile, it works too).

mail_e36 2010-04-22 18:48

Re: How to make aliases ?
 
The above instructions seem like they only apply to the current xterm session, all new sessions need "source /home/user/.profile" run each time to see all aliases.

Does anyone have any ideas?

geneven 2010-04-22 19:16

Re: How to make aliases ?
 
I prefer to use vi to create the file, but it seemed to work for me.

You could also use leafpad if you have it installed.


You would go to the /home/user directory

You would type vi .profile and hit enter

after the vi editor opened you would type the letter i

then you would type the alias line you wanted

then you would type the esc key

then you would type :wq and hit enter

then you would be thru. close the xterm, reopen it and see if it works.

Rob1n 2010-04-22 21:50

Re: How to make aliases ?
 
Quote:

Originally Posted by mail_e36 (Post 623185)
The above instructions seem like they only apply to the current xterm session, all new sessions need "source /home/user/.profile" run each time to see all aliases.

Does anyone have any ideas?

The .profile script should be read automatically by every new session. The "source /home/user/.profile" is only needed if you've edited the file since launching the session and want to load the updates.

lma 2010-04-22 23:54

Re: How to make aliases ?
 
Warning: a bogus .profile can render the device non-bootable so be very very careful when editing it, and make sure you have a recent backup in case you need to reflash.

PMaff 2010-09-29 16:56

Re: How to make aliases ?
 
Quote:

Originally Posted by lma (Post 623619)
Warning: a bogus .profile can render the device non-bootable so be very very careful when editing it, and make sure you have a recent backup in case you need to reflash.

It would be a good idea to mark such warnings somehow in
talk maemo...
Thanks again.

matthew maude 2010-09-29 18:39

Re: How to make aliases ?
 
Quote:

Originally Posted by lma (Post 623619)
Warning: a bogus .profile can render the device non-bootable so be very very careful when editing it, and make sure you have a recent backup in case you need to reflash.

how so??? .profile is empty to begin with and if you edit root/.profile all you are doing is adding a line of alias - if you delete its contents it still boots


All times are GMT. The time now is 06:13.

vBulletin® Version 3.8.8