history -c in my .bashrc


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers history -c in my .bashrc
# 1  
Old 06-23-2005
history -c in my .bashrc

Hi, I come into unix with csh, but i switch to bash . I want to clear my command history for each session, history -c, but for some reason this doesn't work in the .bashrc file. I know that the file is running after I type bash on my csh command line because I get the hello back. If I am already in bash and type source .bashrc, then it will work perfectly. What's going on?

#.bash
set -o vi
PS1="\H"\.ba."\!"\>
history -c
source .aliases
echo HELLO
# 2  
Old 06-23-2005
My Understanding

As I understand it, history -c clears the history from the shell environment. It does not clear the .bash_history file. It probably clears the environment variable and then re-reads the .bash_history file as the last step.
Use history -w to overwrite the .bash_history file with the current environment. You can also use history -cw to clear the shell history and then overwrite the .bash_history file.

;
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

The Great History of UNIX (1969-1999) | 30 Years of UNIX History | YouTube Video

I am pleased to announce this new video in 1080 HD for UNIX lovers honoring thirty years of UNIX history spanning from 1969 to 1999 presented in 150 seconds (two and a half minutes) in 1080 HD, celebrating the 50th anniversary of UNIX. The Great History of UNIX (1969-1999) | 30 Years of UNIX... (8 Replies)
Discussion started by: Neo
8 Replies

2. Fedora

.bashrc in Ubuntu 14.04

I am getting this: cmccabe@DTV-A5211QLM:~$ cat ~/.bashrc Command 'cat' is available in '/bin/cat' The command could not be located because '/bin' is not included in the PATH environment variable. cat: command not found cmccabe@DTV-A5211QLM:~$ nano .bashrc Command 'nano' is available in... (9 Replies)
Discussion started by: cmccabe
9 Replies

3. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

4. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

5. UNIX for Dummies Questions & Answers

how to get $1 parameter in ~/.bashrc

Hi, i am trying to convert windows path to linux and do some action on equivalent mounted one for the same in linux. echo '\\server1\source\path\needed_files' | sed -e 's!\\!/!g' | sed -e 's!^//!/!' | sed -e 's!\(/server1/source/path\)\(.*\)!/home/$USER/mount/server1\2!'output: ... (5 Replies)
Discussion started by: greet_sed
5 Replies

6. UNIX for Dummies Questions & Answers

How to review the history and the commands that has been done in this history?

Hello every body, Kindly inform me How Do i find out the time I executed a command previously on UNIX Solaris?? To be more specific and more clear about what i want to know is that I want a command the enables me to know the history and which command i run at this history/time. FYI I used... (5 Replies)
Discussion started by: ahmedamer12
5 Replies

7. Shell Programming and Scripting

bashrc not saving changes

I am trying to do some changes at bashrc file located at /etc directory of my server. First I tried to edit bashrc via FTP downloaded on my pc changed it and loaded back, but it seems like changes are not reflecting. Therefore I tried to change it via putty shel using vim bashrc command. but... (4 Replies)
Discussion started by: ninadgac
4 Replies

8. Shell Programming and Scripting

bashrc

i have made a few changes to my bashrc file...have set a few environmental variable that my shell scripts use. Is there any way that these changes can reflect in evryone else's bashrc who are in the network or do all of them have to copy those changes to their own bashrc file. (2 Replies)
Discussion started by: lassimanji
2 Replies

9. Shell Programming and Scripting

from bashrc to sh..??

:) as soon as i installed my software a couple of weeks ago.. (fedora core 2 vs, 2.6.8-1.521) i decided to switch the shell to sh shell and i know that .bashrc is the bash profile file(???) i want to use the sh version of the same file and make it the main profile file.. how can I switch it and... (3 Replies)
Discussion started by: moxxx68
3 Replies
Login or Register to Ask a Question