LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-07-2004, 12:31 AM   #1
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
adding perm. alias to .bashrc


i want to alias d='ls -laF'

when i add that to the .bashrc in my home dir and then type d i get unknown bash error.

Code:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If running interactively, then:
if [ "$PS1" ]; then

    # don't put duplicate lines in the history. See bash(1) for more options
    # export HISTCONTROL=ignoredups

    # check the window size after each command and, if necessary,
    # update the values of LINES and COLUMNS.
    #shopt -s checkwinsize

    # enable color support of ls and also add handy aliases
    if [ "$TERM" != "dumb" ]; then
	eval `dircolors -b`
	alias ls='ls --color=auto'
	#alias dir='ls --color=auto --format=vertical'
	#alias vdir='ls --color=auto --format=long'
	alias d='ls -laF'
    fi

    # some more ls aliases
    #alias ll='ls -l'
    #alias la='ls -A'
    #alias l='ls -CF'

    # set a fancy prompt
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

    # If this is an xterm set the title to user@host:dir
    case $TERM in
    xterm*)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
        ;;
    *)
        ;;
    esac

    # enable programmable completion features (you don't need to enable
    # this, if it's already enabled in /etc/bash.bashrc).
    #if [ -f /etc/bash_completion ]; then
    #  . /etc/bash_completion
    #fi
fi
ok i have the line in there, but i dont have access to that alias? did i do something wrong? do i need to edit that file as root instead of user? please a bit o guidance here.
 
Old 12-07-2004, 08:20 AM   #2
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 31
Maybe you need to logout and login again?
Or just execute the file? (sh .bashrc)
 
Old 12-07-2004, 02:28 PM   #3
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
thats what it was. i needed to execute the sh .bashrc

thank you much.
 
Old 12-07-2004, 09:01 PM   #4
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 34
next time you make a change, simply source the file using the . command

. .bashrc
 
Old 12-08-2004, 11:53 AM   #5
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
Quote:
Originally posted by amfoster
next time you make a change, simply source the file using the . command

. .bashrc
huh? what does that mean? pardon my newbieness.
 
Old 12-09-2004, 06:16 AM   #6
amfoster
Member
 
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 34
The . command, or "source" is used to execute a file in the enviroment you are already in. You can use it with any of the enviroment files to keep from having to log all the way out.
 
Old 12-09-2004, 02:19 PM   #7
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
ahh that is nice to know.
 
Old 12-09-2004, 02:35 PM   #8
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
So are you on a dumb terminal? you have this line:
Quote:
if [ "$TERM" != "dumb" ]; then
More it to the bottom so you aren't in an if statement if you want it to always work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using 'watch' on an alias in .bashrc slackist Linux - General 9 01-03-2005 12:52 AM
making alias, can't find .bashrc file djgerbavore Slackware 10 07-23-2004 08:23 AM
My first alias in .bashrc...'apostrophes 'getting' in the way?' Baix Linux - Newbie 3 06-17-2004 02:36 PM
alias and .bashrc whaase Linux - General 3 11-02-2003 07:03 PM
alias and bashrc Haldir Linux - Newbie 3 06-14-2002 05:11 PM


All times are GMT -5. The time now is 04:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration