Using Bash insteal of Perl? (bashrc) - bash

I was using a bash script in my bashrc and until now everything worked.
Today, i decided to install Perl on my computer (since I'm looking to learn the language) using the method on the website learn.pearl
curl -L xrl.us/installperlnix | bash
(urls are not accepted )
The problem is that now, my script doesn't work anymore, I'm having the error:
"no such file
export PERLBREW_BASHRC_VERSION=0.78"
I tried to use the command "perlbrew switch-off" but it seems that I don't have the program perlbrew installed, and my bashrc is starting with #!/bin/bash so I'm completely lost on you to fix the problem.
I would appreciate some help.
Thanks !

Make sure that you got everything to download the perlbrew, like curl or wget, it is simple to check, try one of theses:
which curl
which wget
If you have one of them you are able to download, otherwise you will need to install either curl or wget.
The latest realease of perlbrew is 0.78.
After theses first steps try to download it again as you did.
There is a mini tutorial which you can use as a guide:
https://perlbrew.pl/
Also I am not sure if you have it installed so you could use:
which perlbrew
To find out if you have it or not. Maybe you forgot the step as describe in the perlbrew site:
sudo cpan App::perlbrew
perlbrew init
Because it seems like your environment was not set yet.

Related

Command 'rvm' not found, did you mean:

I just installed rvm on my kali machine but after rebooting it, the terminal said that the command wasn't found and asked if I meant something else. I used curl -sSL https://get.rvm.io | bash -s stable --ruby to install and run the rvm install script. Everything went smooth and when the script finished, it said that all I had to do to get rvm running was execute source /usr/local/rvm/scripts/rvm, which I did. I even checked my path to make sure that everything was normal, and I think it is. Here is what it is:
/usr/local/rvm/gems/ruby-3.0.0/bin:/usr/local/rvm/gems/ruby-3.0.0#global/bin:/usr/local/rvm/rubies/ruby-3.0.0/bin:/opt/impacket/build/scripts-3.9:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools:/usr/local/go/bin/:/root/go-workspace/bin
Can someone help me solve this?
You'll need to update your bashrc (or equivalent) so that the rvm stuff gets imported every time.
Just add source /usr/local/rvm/scripts/rvm to the end of that file

How to customize edwin editor on mac?

I was following this tutorial: https://groups.csail.mit.edu/mac/users/gjs/6.945/dont-panic/ (section 3.4.2) to get the edwin editor setup on my mac where they use the following file: http://web.mit.edu/6.945/dont-panic/.edwin for customizing the editor. However, I am unable to proceed using the instructions they have provided.
I cannot find the .edwin file on my mac and the wget command does not work. I was wondering if there was a different way of doing this. Any help would be appreciated. Thanks!
Until you create this file on your machine, it will not exist. This seems rather obvious.
Until you install a wget binary from somewhere, there is no wget binary on your mac, so of course the command "does not work".
Failing actually installing a copy of wget, use curl, which ships on the mac.
$ curl -o .edwin http://web.mit.edu/6.945/dont-panic/.edwin

Why Ocaml version located on file (4.04.0) different from what terminal says (4.03.0)?

I've been trying to run a program that uses graphics (which I've already posted about here). This post and other posts have led me to the conclusion that I need create a ~/.bashrc and put in it:
alias ocaml="/usr/local/Cellar/ocaml/4.03.0/bin/ocaml”
However, /usr/local/Cellar/ocaml/4.03.0/bin/ocaml is not a valid file in my system. B/c when I ran this in the terminal:
$ cd /usr/local/Cellar/ocaml/4.03.0/bin
-bash: cd: /usr/local/Cellar/ocaml/4.03.0/bin: No such file or directory
But changing the version to 4.04.0 works:
$ cd /usr/local/Cellar/ocaml/4.04.0/bin
But when I ask the terminal what ocaml I'm running:
$ which ocaml
/Users/Username/.opam/4.03.0/bin/ocaml
It says I'm running 4.03.0
And my error message when I try to run an ocaml program using graphics is :
Error: Cannot find file /Users/Username/.opam/4.03.0/lib/ocaml/graphics.cma
So it seems like my terminal is running 4.03.0 but I don't have OCaml 4.03.0 in /usr/local/Cellar/ocaml/4.03.0/bin and instead I have 4.04.0??
That to me seems very strange.
If anyone could please help me out that would be greatly appreciated! I have spent hours trying to figure out how to run graphics on my computer and I have no clue why the solutions posted in previous StackOverflow posts are not helping :(
i don't find it strange.
The alias command works only in your terminal, not for the entire system.
Probably you have "/Users/Username/.opam/4.03.0/bin/ocaml" in your PATH variable.
I suggest to do:
export PATH="/usr/local/Cellar/ocaml/4.04.0/bin:$PATH"
then:
which ocaml
and the path should be the 4.04 version
It looks like that you have multiple installations of OCaml on your machine. Some of them being installed via opam, and others either manually, or via system package management. I would suggest just to ignore the latter and focus on opam.
To use opam, you need to activate your switch. This can be done manually,
eval `opam config env`
(Note the use of backticks)
You can also put it in your profile, so that opam will be activated every time you logged in. You can even ask opam to do it for you:
opam config setup --user
Finally, if you want to run a program, out of your normal terminal environment, and do not want to depend on some pre-setup steps (i.e., on a client's machine), then you can use opam config exec:
opam config exec -- ocaml my-ocaml-script.ml

how can I run shell script line by line [duplicate]

I'll love something like Microsoft Visual Studio's line-by-line debugging in bash, with current variables values and so.
Is there any tool or way to do it? set -x and set -v are nice but not perfect.
See bashdb.
If it's installed on your system, see man bashdb.
If it's not installed, see http://bashdb.sourceforge.net
Yes. Use "bashdb" from http://bashdb.sourceforge.net/
Latest version at time of writing
http://sourceforge.net/projects/bashdb/files/bashdb/4.2-0.8/
If you are on a Mac (like I was) then you might need to install the GNU version of Bash.
I did that using "MacPorts"
http://www.macports.org/
Once you have MacPorts...
port install bash
Then follow the instructions to
./configure (in bashdb unpacked directory)
make
sudo make install
Then add the folder where bashdb can be found in your PATH

Is it possible to debug bash scripts line-by-line?

I'll love something like Microsoft Visual Studio's line-by-line debugging in bash, with current variables values and so.
Is there any tool or way to do it? set -x and set -v are nice but not perfect.
See bashdb.
If it's installed on your system, see man bashdb.
If it's not installed, see http://bashdb.sourceforge.net
Yes. Use "bashdb" from http://bashdb.sourceforge.net/
Latest version at time of writing
http://sourceforge.net/projects/bashdb/files/bashdb/4.2-0.8/
If you are on a Mac (like I was) then you might need to install the GNU version of Bash.
I did that using "MacPorts"
http://www.macports.org/
Once you have MacPorts...
port install bash
Then follow the instructions to
./configure (in bashdb unpacked directory)
make
sudo make install
Then add the folder where bashdb can be found in your PATH

Resources