7

I installed perl using following command:

curl -L http://xrl.us/installperlnix | bash

after that i run following command to create soft link

ln -sf /usr/local/bin/perl /usr/bin/perl

now I'm trying to run commands like dir, mkdir, ll, rm, vi but nothing seems to be working for me. also when i try to login into my shell i get following msg at startup:

Last login: Wed Apr  4 21:50:12 2012 from x.y.z.ip
-bash: perl: command not found

please help.

Here is system detail:

cat /proc/version
Linux version 2.6.18-274.18.1.el5.028stab098.1 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Sat Feb 11 15:30:41 MSK 2012

cat /etc/issue
CentOS 5.7 32 bit
Kernel \r on an \m

Don't know if perl was already installed or not. and now i can't check.

Burhan Ali
  • 153
  • 1
  • 3
  • 13
Kashif
  • 473
  • 9
  • 20
  • 2
    What kind of linux distro were you using that didn't include perl by default?!?! – EEAA Apr 04 '12 at 17:58
  • What do your bash profile scripts contain? – Tamara Wijsman Apr 04 '12 at 18:02
  • Sorry Tom, but how can i check it that you are asking? i didn't do any manual change in anything. – Kashif Apr 04 '12 at 18:04
  • 23
    I'm sorry, you didn't check if perl was already installed, you ran some random script you downloaded off the internet (presumably without checking out what it was doing first, since you just grabbed it with `curl` and piped it straight into a shell), and now you're surprised your system has problems? There's pretty much no way we can troubleshoot this mess for you with what's given above. Best advice: Restore from your backups, and ***please*** think a little harder before you act in the future. – voretaq7 Apr 04 '12 at 18:10
  • I installed perl as per instruction on this website: http://learn.perl.org/installing/unix_linux.html and there was nothing written to check it before. also another tutorial way saying to have updated perl. and Yes i had in my mind that what is bash doing in this command but I had no clue that it is going to create mess for me. and yes. I ll not install my OS again. I ll try to fix this issue myself. no worries what happens. and thanks for your NO HELP. – Kashif Apr 04 '12 at 18:17
  • 5
    For the record, I want to *shoot* people that recommend installing things that way. It teaches very bad habits, and as you've found out, can cause significant problems. – EEAA Apr 04 '12 at 18:20
  • Sir ErikA issue is fixed by editing bashrc file through WinSCP as no command was working on shell. Thanks for your hlep. – Kashif Apr 04 '12 at 18:32
  • 11
    I don't think this deserves the downvotes. Someone **did something stupid**, but they didn't **ask a stupid question**. Think back to your beginner days--who hasn't done something on par with this and then needed help? The questioner was rude when attacked, but his/her initial question, I think, was sound. – Zac B Apr 04 '12 at 18:37
  • But this is fact that rude attitude of voretaq helped me to fix my issue. otherwise no one here had answer that how to fix this issue. the key of issue was to open file through WinScp or anyother software like that as no command was working on ssh. not even vi, cat etc. – Kashif Apr 04 '12 at 18:46
  • @ZacB: You could say that the question is off-topic because the OP is presumably not a professional system administrator, which is where some of the downvotes may come from. – gparent Apr 04 '12 at 18:48
  • 1
    Also user115079, please mark the question as answered. – gparent Apr 04 '12 at 18:49
  • @gparent: professionals don't do stuff like this? Guess none of the junior sysads where I used to work got that memo ;) "What do you mean stupid? I just pasted 1200 lines of bash into my terminal from this forum post. I don't **think** it messed anything up..." – Zac B Apr 05 '12 at 20:41
  • I dunno man, where I work the word 'script' doesn't come up often, even less piping them from forums. I'm a hobbyist programmer though, so I'm trying to turn this around. – gparent Apr 06 '12 at 19:25
  • 1
    @ZacB: No, professionals become professionals by doing this. Ipso facto not done by professionals. NOTE-they become professionals once they do this and learn from it. – Bart Silverstrim Apr 07 '12 at 16:55
  • As a side note, the "no help" comment from the OP is a definite turnoff for some; if you made a mistake and realized you made a mistake, just acknowledge you screwed up. Even if you find a comment unhelpful or snarky, replying to it does nothing to help the situation. Worse, you can offend people who might be able to help, despite their cranky demeanor. They're usually cranky because they have found themselves having to help ungrateful people making silly mistakes in the first place, so tolerating some crankiness isn't always a bad idea as long as it's not offensive/personal. – Bart Silverstrim Apr 07 '12 at 16:58
  • I also see that there's a "rude comment" from the OP about Voretaq's comment, despite the fact that I see Vortaq took the time to edit the answer as well as offer advice on it. Yet...no acknowledgement of him volunteering his time to help. – Bart Silverstrim Apr 07 '12 at 17:00
  • @Bart.. first thing, i also said thanks to those people who tried to help me out (in a positive way) even when they said to reinstall OS as they had no way as command prompt wasn't working. every one was telling me to open file and edit it but no one was telling me How to open that file. still i appreciated there time and efforts. I wrote those words for Vortaq coz he was criticizing me in a -ve way that was even discouraging me. I didn't download that script t rold t imfrom some random site. It is a well-known site for perl. (perl.org) – Kashif Apr 07 '12 at 21:38
  • If i'm coming to this forum then it simply means I have made a mess.no question about that.this is secondary issue if it is a silly mistake or professional one. may be he spent 5 minutes or more to read/write that answer for me but it could take only few seconds to write that open this file through some tool like i used WinSCP. and please highlight where he actually helped me... in this line "There's pretty much no way we can troubleshoot this mess for you with what's given above."? Do you find it useful? at least its not for me. i disagree. but I'm sorry if i offended someone. – Kashif Apr 07 '12 at 21:42

2 Answers2

12

Perl was probably already installed, and who knows what that install script did to your environment to screw it up.

Two lessons here:

  1. Never install software using the above "pipe to bash" method without first verifying that 1) the install works, 2) it won't mess things up, and 3) it doesn't do anything malicious.
  2. Always, always, always check to see if a package is provided either by default or by your distro's default package repository before going to a third party.

You may be able to recover by fixing your ~/.bashrc file to a known-good state, but honestly, I'd recommend re-installing your OS and trying again.

voretaq7
  • 79,345
  • 17
  • 128
  • 213
EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Thanks for your help Erika. I didn't know that it was going to change bash settings. I'll care about it next time. Thanks again. – Kashif Apr 04 '12 at 18:18
  • 8
    @user115079 this is the danger of blindly following tutorials without the requisite understanding: They tell you to do something, you do it (honestly trusting the guy who wrote the tutorial won't do anything destructive), and what the author felt was an innocent addition to your `.bashrc` created problems. [We have an entire site dedicated to Unix/Linux](http://unix.stackexchange.com) that can probably point you at good (and probably ***safer***) tutorials as well as helping you get past any initial hurdles without damaging your system... – voretaq7 Apr 04 '12 at 18:49
8

The error on login is from the following line being in your bashrc script:

~/perl5/perlbrew/etc/bashrc

You can likely fix perl by deleting /usr/bin/perl as the install script didn't put it in /usr/local/bin/perl by default... not sure where the ln command was inspired from. You may have to consult your distro to fix Perl, not sure.

The installation script for perlbrew is much longer than I'm willing to read through. If you're still having problems you're best bet is going to be wipe and restore from backup.

Chris S
  • 77,337
  • 11
  • 120
  • 212