Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 18 Dec 2014, 21:34
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
alias not working in console
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [6 Posts]  
Author Message
vientito

Joined: 17 Sep 2006
Posts: 83

PostPosted: Thu 16 Nov 2006, 23:47    Post subject:  alias not working in console  

this may be a very stupid thing, but i try various tricks and still could not get it to work. i hope someone could spot what's wrong here.

i define a few aliases in /etc/profile.local like follows:

alias ll='ls -cl'

but for some strange reason they never appear later after boot when i click on desktop "console" to run rxvt.

the shell seems not to get it at all.
Back to top
View user's profile Send private message 
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: Fri 17 Nov 2006, 00:13    Post subject:  

i'm not sure why aliases in /etc/profile do not apply when you open a console ... i think setting the prompt in /etc/profile does not work either

i think the correct place to put aliases for bash is .bashrc ... they seem to work properly there ... /root/.bashrc will execute automatically when you open a console window, IF you have SHELL=/bin/bash set ... if you have SHELL=/bin/sh set, the file in ENV will execute

you can put this in /etc/profile.local if you like:

export ENV=/root/.bashrc

and .bashrc will execute when you open a console and SHELL=/bin/sh

or you could do this:

export ENV=/root/.shrc

and a file called .shrc in /root will execute ... you could have it source /root.bashrc if you want, then you only need to edit one file and it will work with both bash and sh shells

by the way, /bin/sh IS bash ... sh is just a symlink to bash ... but bash behaves differently if it is named sh

it can be complicated, but what i do is put this in /etc/profile.local:

export SHELL=/bin/sh
export ENV=/root/.bashrc

and put my aliases in .bashrc
Back to top
View user's profile Send private message 
Gn2


Joined: 16 Oct 2006
Posts: 936
Location: virtual - Veni vidi, nihil est adpulerit

PostPosted: Fri 17 Nov 2006, 01:07    Post subject:  

Add the aliase to ~/ .bashrc > ('~" indicates users' "home" folder )
/etc/profile is normally sourced by /etc/skel :
And used to build a user desktop folder content. (useradd or default install behaviour)

Any I.E.. .bashrc or .xinitrc residing there are parsed/used - if none exist, the system wide defaults are used.
Aside - varied profiles may be utilized.
Environment is then local/session only - It is left to user's imagination how that may be beneficial

Normally any new aliase would necessitate logging out & back in ;
To implement in same session - type:
Code:
bashrc
in CLI shell.
IIRC - Exporting Env. variable is also session only.
(User may research how to make it "stick")

Why are you using " -cl" - that has little difference to "-ll" - other than to alter time-stamp listing order. ?

Of more use - sugggest you use rm = 'rm -i'.
That applies also to "mv & cp" commands - interactive permission is then Req'd.
Serves as a reminder before any possibly dangerous task is
hastily performed
Rule of thumb - back up original BEFORE committing.to un-recoverable event ~

http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

HTH.
Back to top
View user's profile Send private message 
GuestToo
Puppy Master

Joined: 04 May 2005
Posts: 4078

PostPosted: Fri 17 Nov 2006, 01:50    Post subject:  

Quote:
sugggest you use rm = 'rm -i'

that's why i usually use rm -f in a script ... just in case someone has aliased rm='rm -i'

.bashrc does not execute if SHELL=/bin/sh ... i'm not sure whether Puppy's default shell is bash or sh ... they do behave differently, so i set SHELL in profile.local

by the way, there's a lot of information on the Gentoo wiki and forums ... for example:

http://gentoo-wiki.com/TIP_Some_pretty_.bashrc_hints
Back to top
View user's profile Send private message 
Gn2


Joined: 16 Oct 2006
Posts: 936
Location: virtual - Veni vidi, nihil est adpulerit

PostPosted: Fri 17 Nov 2006, 02:26    Post subject:  

I suppose it is one unfortunate side affect of using Ash we must live with.
IIRC Ash is used by most distros for varied "legacy" considerations as well as initiate system installs ?

Backwards compatabilty of Bash was one of goals, in most cases there is no problem.
Then.... some odd situation arises leaving us scratching for a cause.
One reason a good install script should parse any local environment - ("else" use )
And the Bash tutorial explains in detail interactive vs execute only scripts.

Aside: Useful as " precautionary" optional parameters of CLI defaults may be - there is NO substitute to "think twice, act once"

Yes, IMO - Gentoo documentation is the present paradigm of info sourcing.

(That was Wink one of deciding factors to use of Gentoo )
Without them - the learning curve is much steeper.
Back to top
View user's profile Send private message 
marksouth2000

Joined: 05 Apr 2006
Posts: 620

PostPosted: Fri 17 Nov 2006, 13:36    Post subject:  

According to the man page, /etc/profile is sourced by bash only when it is invoked as a login shell.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [6 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

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
[ Time: 0.0553s ][ Queries: 11 (0.0038s) ][ GZIP on ]