How do i run url command from my terminal? [duplicate] - macos

This question already has answers here:
Execute bash script from URL
(16 answers)
Closed 4 years ago.
I have commands for example like this:
git clone https://example.com/mygit.git && cd mygit && npm i
in a file that i uploaded to an url, I want to run it from terminal, how do I run it from my terminal?

Are you using a Linux distro or Windows?
Assuming its Linux - you need to have the file execute permission bit set ( see here for more information -> https://www.tutorialspoint.com/unix/unix-file-permission.htm )
Then you need to execute the file with the path specified ie. if the script is called "myScript.sh" you would run:
./myScript.sh
or
/path/to/myScript.sh

Related

Running MATLAB script from terminal Mac [duplicate]

This question already has answers here:
matlab execute script from linux command line
(3 answers)
How to call MATLAB script from command line?
(4 answers)
Closed 1 year ago.
I am trying to run a matlab script from the terminal on MacOS. I am doing the following:
/../matlab -nodisplay -r
to open matlab from terminal, then to run the script that is on a different path I write
cd ('/.../test/')
test1.m
It runs, I get some error regarding the font. But I am not able to visualise the plots in the script, any suggestions?

How to access WSL PATH from Powershell core? [duplicate]

This question already has an answer here:
What is the difference between calling a command via "wsl [command]" and opening a wsl shell and calling "[command]"?
(1 answer)
Closed 1 year ago.
If I open up the Ubuntu app (terminal) and type echo $PATH, I get a bunch of directories. If I type wsl echo $PATH in Powershell core, I get absolutely nothing (a blank row). I would like to run a Linux command from Powershell core, how do I do that?
That's because the .bashrc isn't run when you just run wsl <command>, you need to run wsl bash -c '<command>', or run <command> while inside a bash shell.

Bash command on cURL for Windows [duplicate]

This question already has answers here:
How to run .sh on Windows Command Prompt?
(11 answers)
Closed 5 years ago.
I want to install Hyperledger Fabric to build blockchain apps and the documentation tells me to run a bash command to extract platform-specific binaries.
http://hyperledger-fabric.readthedocs.io/en/release/samples.html#binaries
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/v1.0.5/scripts/bootstrap.sh | bash -s 1.0.5
And to this, Terminal outputs:
'bash' is not recognized as an internal or external command, operable program or batch file.
What's the problem I'm facing? I'm running cURL version:
curl 7.58.0 (x86_64-pc-win32) libcurl/7.58.0 OpenSSL/1.1.0g (WinSSL) zlib/1.2.11 WinIDN libssh2/1.8.0 nghttp2/1.30.0
PS: Already installed curl into environment variables.
The command you pasted pipes all its output to a program called bash. This is not a standard program for windows.
As stated on the website you've linked:
If you are running on Windows you will want to make use of the Docker Quickstart Terminal for the upcoming terminal commands. Please visit the Prerequisites if you haven’t previously installed it.
So... use the Quickstart Terminal and read about the Prerequisites first?

Why can't I execute this simple shell script? [duplicate]

This question already has answers here:
Why can't I change directories using "cd" in a script?
(33 answers)
Closed 9 years ago.
I have a file called go in ~/
All I want to do is to be able to run go and have it cd to this other dir.
This is what the go file looks like:
$ cat go
#!/bin/bash
cd ~/Desktop/rs3
I ran the line $ chmod +x go
And then the line ./go to attempt to run the file.
If i put echo whatever in the file it will print whatever to the console, but the cd command never works.
Thanks.
It doesn't work because the script runs in a subshell, so the environment is different.
What you can do is to alias go='cd ~/Desktop/3s3' - as it's an alias, the shell performs the substitution and runs the cd on itself, as if you've just typed it.
You should define the alias in your ~/.bashrc, ~/.bash_profile or any file that gets sourced when you login.

Export shell directory to terminal [duplicate]

This question already has answers here:
Why can't I change directories using "cd" in a script?
(33 answers)
Closed 7 years ago.
I'm creating a shell script that will allow a back functionality on my shell. What would be a good way to change the terminal's directory in the script.
Just running something like this in my back.sh file doesn't work:
cd /
Even when I run the file like
source ./back.sh
A sample file that is not working properly:
#!/bin/bash
cd ~/Movies/
when I run source ./back.sh or source back.sh
Here are my 2 cents about the difference between . and source builtins: There isn't any.
Since you mentioned that you use . for cd ../, make sure that the proper . and source are executed and are really the same thing:
user#host> type source
source is a shell builtin
user#host> type .
. is a shell builtin
Other than that /bin/bash --version may turn out helpful, too.

Resources