wgilster
asked on
Can't rename .bashrc file
I log in as root and copy my .bashrc file from my user directory to the /etc/profile.d directory using the cp command. I then try to rename the .bashrc file and it simply doesn't work. It doesn't say it can't find the file, in fact the rename command doesn't say anything it just returns back to the bash prompt.
"rename .bashrc java.sh"
I can see that .bashrc exists in the /etc/profile.d directory but I just can't rename it! Am I calling the rename function correctly? What am I doing wrong?
"rename .bashrc java.sh"
I can see that .bashrc exists in the /etc/profile.d directory but I just can't rename it! Am I calling the rename function correctly? What am I doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Of course that worked.
I knew that rename could do mass renaming through wildcards and parsing, but I must not have got the syntax down correctly. It must be something like:
rename "sourcefiles" "expressiontoreplacewith" "expressiontofind"
Thanks,
I knew that rename could do mass renaming through wildcards and parsing, but I must not have got the syntax down correctly. It must be something like:
rename "sourcefiles" "expressiontoreplacewith" "expressiontofind"
Thanks,
rename .bashrc java.sh .bashrc
# as Glenn said.
# as Glenn said.
Close wgilster.
rename "expressiontofind" "expressiontoreplacewith" "sourcefiles"
Man don't bite;-)
-- Glenn
rename "expressiontofind" "expressiontoreplacewith" "sourcefiles"
Man don't bite;-)
-- Glenn
ASKER
I realize Man is always there for me, but when you don't know what command to use, Man doesn't help. I just used rename because I thought it was a simple rename-a-file-command. I guess I didn't think about the mv command. Thanks all.
man -k
apropos (which usually is an alias (or similar) for man -k)
Is there to help;-)
-- Glenn
PS. I didn't mean to be rude, it's just that these commands (mv, cp, cd, mkdir etc etc) are often mentioned (and "trained") very early in any ol' Unix/Linux introdutory book. Get one & read it, you'll have it easier afterwards. DS
apropos (which usually is an alias (or similar) for man -k)
Is there to help;-)
-- Glenn
PS. I didn't mean to be rude, it's just that these commands (mv, cp, cd, mkdir etc etc) are often mentioned (and "trained") very early in any ol' Unix/Linux introdutory book. Get one & read it, you'll have it easier afterwards. DS
You see, rename isn't what you think.
mv is the tool to move files from one name to another, rename on the other hand will rename a bunch of file from one "pattern" to another. syntax is something like: rename <old pattern> <new pettern> <files to apply rename to>.
If you had written
rename .bashrc java.sh .bashrc
it would have renamed .bashrc to java.sh
Read the relevant man pages:
man mv rename
(and perhaps an introduction to Unix/Linux;).
-- Glenn