.bashrc help
Hi,
Im having quite of a bit of trouble with this one. so far i have done: find / -name .bashrc to display all the .bashrc files on the system -How can i tell which one ( if not all ) of these files modify the PS1 varaible? Im guessing that the output is displaying the full path name. Although most paths have permission denied. -What command can i use to display the file protection? -When i redirect the output to an emacs file i only the /home entries Again, all .bashrc files on the system and need the file protection and to redirect all of the output to a file. Hints are appreciated. |
you can use grep for, say, "PS1=" to check if the PS1 variable is changed. and you must have permission to any file you read... so run the command as root or something.
|
Expanding on the above, the only place a .bashrc file should exist is in the /home dirs. Its a user specific/customisable file, along with .bash_profile.
To show perms use ls -l |
Quote:
Quote:
Quote:
Quote:
Quote:
|
I need to add the protection to the " find / -name .bashrc " output
ls -lha .bashrc gives me the protection of the .bashrc file but not every .bashrc file on the system. is there some way to link these commands together? And the redirection worked nicely. |
I answered a similar question here today:
http://www.linuxquestions.org/questi...ight=stat+find However, why do you want to do so? Did you read the fragment of the man page I gave you? You will find .bashrc only on the home directory of your users, and nowhere else. And only the one for the current active user is relevant for you. I don't know what do you expect to find. |
lol neither do i.
but i want to get this right. How do i know that any of these files modify the PS1 varaible? i understand the ls -l all the files in my home directory but insted of my /home the .bashrc files insted |
There is only one hidden .bashrc file in each user's home dir.
To see it, use ls -a if you want perms as well ls -la You can check for PS1 being set using grep grep PS1 .bashrc |
Quote:
Everything you need to know is in that bit of info I pasted from the bash man page. However, since I have some spare time right now I will explain it a bit better for you. You can consider /etc/profile like kind of a global bash configuration file. You shouldn't ever need to change it, unless you know what you are doing (and in that case, you wouldn't be asking here). So, that leaves one less option. For the rest... If you login on text mode, in a pure text console outside X, then bash will be in login mode (easy to understand). In login mode, bash reads one and only one amongst these files: ~/.bash_profile, ~/.bash_login, and ~/.profile. Bash looks for them in that same order, and only the first one found is used, even if it's an empty file (as long as you have read permissions over them). If you didn't log in text mode, then you will be accessing bash using an xterm or a similar terminal emulator (konsole, gnome-terminal, urxvt or whatever). Then bash is in non-login mode. In this case, the relevant file is ~/.bashrc. So, there you are: that's the info you need. If you want to change the value of PS1, just put it in the right file, and it will work. If these files do not exist, just create them using a regular text editor and make sure you name them correctly, starting with a dot. |
Since you're using the find command, consider using the -exec grep -H PS1 {} option to implement Chris' suggestion. (You will, of course, need to prepend the find with a sudo or su -c, or just run in a root shell.)
|
i found a simlar command:
find . -type f | xargs grep .bashrc But im not sure if these files modify the PS1 varaible. LOL And the files are mostly bash_history |
Hi,
I'm not sure as to your reasoning but if you would read the 'man bash' then things may clear up. Code:
excerpt 'man bash'; Code:
#.bashrc Code:
# .bash_profile |
All times are GMT -5. The time now is 05:06 PM. |