Solved

Can't rename .bashrc file

Posted on 2002-07-03
7
667 Views
Last Modified: 2013-12-15
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?
0
Comment
Question by:wgilster
  • 3
  • 2
  • 2
7 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
Comment Utility
try following:
  cd /etc/profile.d && mv .bashrc java.sh

0
 
LVL 20

Expert Comment

by:Gns
Comment Utility
Ahoffmann's suggestion is correct wgilster.

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
0
 
LVL 1

Author Comment

by:wgilster
Comment Utility
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,
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
rename .bashrc java.sh .bashrc
# as Glenn said.
0
 
LVL 20

Expert Comment

by:Gns
Comment Utility
Close wgilster.
rename "expressiontofind" "expressiontoreplacewith" "sourcefiles"

Man don't bite;-)

-- Glenn
0
 
LVL 1

Author Comment

by:wgilster
Comment Utility
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.
0
 
LVL 20

Expert Comment

by:Gns
Comment Utility
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
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now