Solved

Can't rename .bashrc file

Posted on 2002-07-03
7
713 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses

623 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