Jump to content

Creating a new alias [solved]


Recommended Posts

I am trying to create a new alias for when I shutdown my box. As Chalex20 told me on a previous message I open /etc/bashrc with vi and added the following line (as root)

 

alias shut='shutdown -h +1 "That's all folks for today"'

 

I rebooted the box but it is not working. Did i miss something?

 

Thanks

TheNovice

Link to comment
Share on other sites

This is my bashrc

 

System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
	umask 002
else
	umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
	xterm*)
		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
	   ;;
	*)
	   ;;
esac
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if [ -z "$loginsh" ]; then # We're not a login shell
	for i in /etc/profile.d/*.sh; do
		if [ -x $i ]; then
			. $i
		fi
	done
fi
fi

unset loginsh
alias today='date +"%A, %B %-d, %Y"'
alias shut='shutdown -h +1 "That's all folks"'
~
~
"bashrc" 36L, 763C											  36,46		 All

 

This is my .bash_profile

 

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

alias l='ls -l'
".bash_profile" 16L, 245C									   1,1		   Top

 

TheNovice

Link to comment
Share on other sites

That bashrc that you just posted looks like /etc/bashrc. Ramfree17 asked you to post the .bashrc (note the leading period) in your home directory. Please post that. Here is my $HOME/.bashrc, which is the default from the 2006 install:

 

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

If your $HOME/.bashrc does not look like the above, that could be your problem.

 

Note that it will execute /etc/bashrc, if that file exists. The period followed by a space before the /etc/bashrc command is a special command that makes any variables that are set in the script available after the script has finished executing.

 

Also, if there is a bashrc (without the leading period) in your home directory, that is not going to get executed when you open a terminal (note your .bash_profile specifically references .bashrc in your home directory, not bashrc).

Link to comment
Share on other sites

Ooops sorry. here it is:

 

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# enable programmable completion features
if [ -f /etc/bash_completion ]; then
	. /etc/bash_completion
fi
~
~
".bashrc" 13L, 231C											 1,1		   All

 

TheNovice

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...