Unalias ls and vi

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Unalias ls and vi
# 1  
Old 05-08-2014
Unalias ls and vi

I have a question on issuing the unalias in my .profile. I want to turn off color in both my ls command and using vi to edit, and when I set these 2 statements in my .profile it accomplishes that task.

unalias ls
unalias vi

However, a few of my crontab jobs require me to fire off the job with my .profile in the crontab entry. And when that happens I am getting an email kicked back saying:

~/.profile: line 41: unalias: vi: not found
~/.profile: line 42: unalias: ls: not found

If I just execute the . ./.profile I get no errors. So why am I getting the email kickback and what is the proper way to set it? Thanks.
This User Gave Thanks to islanderman For This Post:
# 2  
Old 05-08-2014
I'm guessing cron is using a different shell than you login with; when you login, it understands unalias, when cron fires off, it does not.

What shell are you using? Perhaps you can use a file more specific than ~/.profile so cron doesn't load it too.
# 3  
Old 05-08-2014
Is the cronjob executed as you or as root?
# 4  
Old 05-09-2014
not root, under my account:

Code:
15 03,04 * * * . $HOME/.profile; $HOME/bin/RunReports.pl

Moderator's Comments:
Mod Comment Code tags for code, please.

Last edited by Corona688; 05-09-2014 at 12:06 PM..
# 5  
Old 05-09-2014
Quote:
Originally Posted by Corona688
What shell are you using?
What shell are you using?
# 6  
Old 05-09-2014
using bash
# 7  
Old 05-09-2014
Put your unaliases in ~/.bash_profile instead, which is only read for login shells.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question