Solved

Can't rename .bashrc file

Posted on 2002-07-03
7
703 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 51

Accepted Solution

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

0
 
LVL 20

Expert Comment

by:Gns
ID: 7129557
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
ID: 7129835
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 7129855
rename .bashrc java.sh .bashrc
# as Glenn said.
0
 
LVL 20

Expert Comment

by:Gns
ID: 7129994
Close wgilster.
rename "expressiontofind" "expressiontoreplacewith" "sourcefiles"

Man don't bite;-)

-- Glenn
0
 
LVL 1

Author Comment

by:wgilster
ID: 7137730
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
ID: 7138712
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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