Register
It is currently Fri Dec 19, 2014 3:17 pm

adding a .alias file


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Sun Nov 07, 2010 3:55 pm   

Joined: Wed Nov 26, 2008 7:43 pm
Posts: 50
Location: Texas
I have seen some people use a .alias file to keep all the aliases
sepparate from their .bashrc code. I am getting errors when I try
to do this, and I don't know why?

I put the following line in my .bashrc file:
# Aliases
# #######
source '/home/ted/.alias'

and the following in the .alias file:

# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask. For example, alias rm='rm -i' will mask the rm
# application. To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.

# Interactive operation...
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

# Default to human readable figures
alias df='df -h'
alias du='du -h'

# Misc :)
alias less='less -r' # raw control characters
alias whence='type -a' # where, of a sort
alias grep='grep --color' # show differences in colour

# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty' # classify files in colour
alias lr='ls -lrt'
alias ls='ls -skFGh'
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
alias ll='ls -l' # long list
alias la='ls -A' # all but . and ..
alias l='ls -CF' #

but I get this error:

bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found

What am I doing wrong here


Top
 Profile  
 PostPosted: Sun Nov 07, 2010 4:45 pm   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
What kind of line endings do you use? You might try to run dos2unix on your .alias file.


Top
 Profile  
 PostPosted: Mon Jul 30, 2012 12:19 pm   

Joined: Sun Jul 29, 2012 2:08 pm
Posts: 2
Ugh! A "source", really ? It's doesn't looks cool at all

Personnaly i would do:
$ . ~/.alias

Yes, just a dot. I don't know what it is (no mangpage),
i just know it loads from the file all defined functions, aliases and variables you want.

Never had any problem.
Only when i forgot to comment something in the file i want to load.


Top
 Profile  
 PostPosted: Wed Aug 08, 2012 8:50 am   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
« . » is actually a shortcut for source(0).

Code:
$ diff <(help .) <(help source)
1c1
< .: . filename [arguments]
---
> source: source filename [arguments]
$


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP