The time now is Thu 23 May 2013, 05:37
All times are UTC - 4 |
| Author |
Message |
rga
Joined: 31 Aug 2011 Posts: 2
|
Posted: Wed 31 Aug 2011, 15:49 Post subject:
How do I define "persistent" bash aliases? (Solved) |
|
Hi everyone,
I have a problem with defining bash aliases.
I have tried putting them in ~/.bash_aliases as I do in Ubuntu, and I have also tried to put them in ~/.bashrc but i can't get them to work.
I'm using Lucid 5.2.8
Last edited by rga on Sat 03 Sep 2011, 14:02; edited 1 time in total
|
|
Back to top
|
|
 |
fratermus

Joined: 28 May 2009 Posts: 20 Location: 75081
|
Posted: Thu 01 Sep 2011, 02:05 Post subject:
Re: How do I define "persistent" bash aliases? |
|
| rga wrote: | Hi everyone,
I have tried putting them in ~/.bash_aliases as I do in Ubuntu, and I have also tried to put them in ~/.bashrc but i can't get them to work.
|
.bashrc should work, but you'd have to start a new term (or source the dotfile) to see it in the current session.
_________________ Eee 900 (16GB SSD), 2GB RAM, Puppy Linux 5.1.1
|
|
Back to top
|
|
 |
rga
Joined: 31 Aug 2011 Posts: 2
|
Posted: Sat 03 Sep 2011, 12:16 Post subject:
Re: How do I define "persistent" bash aliases? |
|
| fratermus wrote: | | rga wrote: | Hi everyone,
I have tried putting them in ~/.bash_aliases as I do in Ubuntu, and I have also tried to put them in ~/.bashrc but i can't get them to work.
|
.bashrc should work, but you'd have to start a new term (or source the dotfile) to see it in the current session. |
Thank you!
Starting a new terminal or running the file from the terminal didn't work (or maybe I did something wrong).
But after a reboot the aliases defined in .bashrc were loaded when i opened the terminal
|
|
Back to top
|
|
 |
fratermus

Joined: 28 May 2009 Posts: 20 Location: 75081
|
Posted: Mon 05 Sep 2011, 09:46 Post subject:
Re: How do I define "persistent" bash aliases? |
|
| rga wrote: | Starting a new terminal or running the file from the terminal didn't work (or maybe I did something wrong).
But after a reboot the aliases defined in .bashrc were loaded when i opened the terminal  |
Running a script (like .bashrc) by name like that really means "load a child shell, run this script in that child shell, then close that shell and fall back to the current/parent shell". In this manner changes made in the child die with it and are not available to the parent unless you go out of your way to preserve them.
". .bashrc" would keep the aliases as long as you were in that terminal session. The first dot means "source the following file", basically as if you typed it on the (current) shell. It does not invoke a child shell.
I hope I have not made matters worse.
_________________ Eee 900 (16GB SSD), 2GB RAM, Puppy Linux 5.1.1
Last edited by fratermus on Mon 05 Sep 2011, 09:53; edited 1 time in total
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|