You are not logged in.

#1 2008-10-31 23:45:00

oxoxo
Member
Registered: 2008-10-31
Posts: 66

help with .bashrc files

hey guys,

Im maxed out on frustration here:

------------------------------------------
find / -type f | xargs grep PS1 .bashrc
------------------------------------------

Im trying to find all the files in the system named .bashrc that modify the PS1 varaible. I think i've done that, but i always second-guess myself.

the thing is, i need to display the file protections, like the first field of ls -l and then grep so that its in teh output

Any Suggestions?

Offline

#2 2008-10-31 23:53:58

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: help with .bashrc files

find / -type f -name '.bashrc' -exec grep -lr PS1 {} \;

I think that should do what you want.

Last edited by Xyne (2008-10-31 23:54:07)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2008-10-31 23:58:28

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: help with .bashrc files

i've did that. All of the output is permission denied. So i thought it was wrong, and found the command that I posted.

What im actually looking for is a way to grep the protection to the command output that you posted dude.

Offline

#4 2008-11-01 00:45:33

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help with .bashrc files

You can use -printf in find and tailor it to your needs. Read up on it in man find for possible values.

Offline

#5 2008-11-01 00:50:48

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: help with .bashrc files

oxoxo wrote:

i've did that. All of the output is permission denied. So i thought it was wrong, and found the command that I posted.

What im actually looking for is a way to grep the protection to the command output that you posted dude.

sudo find / -type f -name '.bashrc' -exec grep -lr PS1 {} \;


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2008-11-01 01:23:21

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: help with .bashrc files

Im not the super-user and cant access that command. This is becoming yet even more frustrating.

Ive tried so many times and all my guesses are logical.

i need to link the first feild of ' ls -l ' to ALL  the paths of ' find / -type f | grep .bashrc '

I should be able to display, that all the paths from the output, ' find / -type f | grep .bashrc ' have some type of protection.

As of right now, my output displays only the path and its relevence to the .bashrc files

Last edited by oxoxo (2008-11-01 01:25:44)

Offline

#7 2008-11-01 01:25:25

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,400
Website

Re: help with .bashrc files

If you are not super-user then how do you expect to modify .bashrc files that are not your own?

Offline

#8 2008-11-01 01:26:39

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: help with .bashrc files

Im not modifying the .bashrc file itself, just the PS1 varaible, checking to see if it has been modifyed.

Offline

#9 2008-11-01 01:33:10

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: help with .bashrc files

oxoxo wrote:

Im not the super-user and cant access that command. This is becoming yet even more frustrating.

Your question then is basically "how can I access something that requires permission without permission" and the answer is that you can't.

To get the "ls -l" output of all files that you can query, use this:

find / -type f -name '.bashrc' -exec grep -lr PS1 {} \; 2>/dev/null | xargs ls -l

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#10 2008-11-01 01:52:21

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: help with .bashrc files

guys, i really appreciate your help.

Xyne, that code just produces ls -l

Offline

#11 2008-11-01 01:58:28

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: help with .bashrc files

oxoxox wrote:

i need to link the first feild of ' ls -l ' to ALL  the paths of ' find / -type f | grep .bashrc '

oxoxox wrote:

Xyne, that code just produces ls -l

That command returns all accessible files on your system named .bashrc containing "PS1" and shows you the fields of ls -l for each file. That's how I understood your explanation. If that's not what you wanted, you'll have to clarify.

Last edited by Xyne (2008-11-01 02:01:49)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#12 2008-11-01 05:23:00

oxoxo
Member
Registered: 2008-10-31
Posts: 66

Re: help with .bashrc files

Sorry, i'll take your word for it.
How do i display the full path of feild 8?  -f8 shows only the file.

Offline

#13 2008-11-01 13:14:44

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: help with .bashrc files

If you don't have sudo permission, then it's unlikely there are many .bashrc files outside your own home folder that you'll have even read permissions for. (Possible, but unlikely.) I'd expect Xyne's command to work (though why the "-r" switch on the grep?), but if the "find" part of it comes up empty, then the "xargs" part of it is just going to execute "ls -l" with no added arguments. What that means is that there aren't any .bashrc files you have read access to with PS1 in them.

Last edited by Profjim (2008-11-01 13:22:41)

Offline

#14 2008-11-01 16:21:09

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: help with .bashrc files

I ran that with sudo on my system and it returned a complete list without the "-r" switch ("find" already passes all the .bashrc files on the system to it).


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB