Re: broke my perl? :(
by Corion (Patriarch) on Aug 25, 2010 at 09:16 UTC
|
It seems that the perl interpreter cannot be found in the locations bash looks for it. You will need to check where perl is and then adjust your Perl scripts and possibly your bash environment to also look for it there.
This shell command tries to run perl in /usr/bin/perl. If /usr/bin/perl does not exist anymore, your system is likely severely broken.
/usr/bin/perl -wle 'print "Still here"'
If that outputs an error and you are on a Unix system, consult with somebody local to you on how to restore your machine to working order. That person should also give you either an introduction to Unix or revoke your rights to make changes to /usr.
If /usr/bin/perl exists and is runnable as is (see above), then it is likely that you just messed up your bash profile, by either setting up an alias for perl to point to something other than /usr/bin/perl. You can find that by typing:
alias
This will list all the aliases defined for your shell session. If you find that you defined an alias for Perl, change that alias, or even better, remove it.
If /usr/bin/perl exists but is a symbolic link to /gsc/bin/perl, you will need to check that /gsc/bin/perl exists and is runnable (see above).
As a general practice, I would adjust the $PATH variable to include another directory instead of copying my scripts into a directory that is already in $PATH. | [reply] [d/l] [select] |
|
Good tip on using another directory for my own scripts. Last time I was meddling with the /usr I broke my ubuntu OS and probably my hard drive.
I tried executing the /usr/bin/perl -wle 'print "Still here"'
which gave the same error as before. The file exists however and is not a mirror to /gsc/bin/perl (/gsc doesn't exist).
<code>
perl -wle 'print "Still here"'
<\code>
Yeilds:
bash: /usr/bin/perl: /gsc/bin/perl: bad interpreter: No such file or directory
Unfourtunately I'm the only one in my office using unix. Is there anything else I can do before reinstalling Ubuntu?
| [reply] |
|
Is there anything else I can do before reinstalling Ubuntu?
You can try
sudo aptitude reinstall perl
I don't know if that will help, but it's certainly worth a try.
Perl 6 - links to (nearly) everything that is Perl 6.
| [reply] [d/l] |
|
|
|
|
| [reply] |
|
| [reply] |
|
"I tried installing latest perl release (5.12.1) from source but /usr/bin/perl is still the script I copied there."
Don't do this, why aren't you reinstalling the version of Perl shipped with Ubuntu via the methods previously suggested?
| [reply] |
|
Re: broke my perl? :(
by JavaFan (Canon) on Aug 25, 2010 at 09:39 UTC
|
That looks like your /usr/bin/perl is actually a script which starts with #!/gsc/bin/perl, and /gsc/bin/perl doesn't exists. | [reply] |
|
I think I understand what I did! In trying to move my script to the perl PATH I thought /usr/bin/perl was a directory and not the actual perl. So I wrote something like:
cp my_script /usr/bin/perl
Thus removing my perl and placing my_script there instead. So I guess reinstalling ubuntu is the way to go then... | [reply] [d/l] |
|
| [reply] |
|
|
Reinstalling the OS just because you lost a file? Just install the package. Or copy it from a live CD. Or another ubuntu installation. Or compile your own perl. Or, gasp, restore from backup.
| [reply] |
|
|
Re: broke my perl? :(
by marto (Cardinal) on Aug 25, 2010 at 09:17 UTC
|
"Suddenly i get this line every time I try to use perl"
Do you mean everytime you run your script (if so can you open it in vi and ensure there are no special characters at the end of the shebang line, e.g. ^M) or are you able to run perl -v
Does the following output anything?
which perl
does history show you removing /usr/bin/perl ?
| [reply] [d/l] [select] |
|
danlab@danlab-laptop:~/BAMs/hela_kromosomer$ perl -v
bash: /usr/bin/perl: /gsc/bin/perl: bad interpreter: No such file or directory
danlab@danlab-laptop:~/BAMs/hela_kromosomer$ which perl
/usr/bin/perl
history does not show me removing perl. And no matter what script I try to run it says this no such file or directory.
| [reply] |
|
| [reply] |
|
| [reply] [d/l] [select] |
A reply falls below the community's threshold of quality. You may see it by logging in. |