Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can't rename .bashrc file

Posted on 2002-07-03
7
Medium Priority
?
755 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 200 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

876 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