Bash command on cURL for Windows [duplicate] - bash

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?

Related

Curl command works in terminal but not in Shell script run in terminal [duplicate]

This question already has answers here:
Are shell scripts sensitive to encoding and line endings?
(14 answers)
Closed 1 year ago.
I am writing a shell script to download and install my company's MSP agent on new Mac computers that a client of ours is going to purchase. When I run the following command in the terminal it works perfectly:
curl --output AgentInstall.zip <url>
however when I put the same exact line in my script it returns the following error on running:
curl: (3) URL using bad/illegal format or missing URL
I'm not doing anything fancy like embedding the command in a variable. I've tried more variations on this then I can count, different options such as -o, -O, -oO, and others, I've tried using
$https://<url>
I've tried wrapping the URL in "", but nothing I have tried has given any sort of success. The thing that baffles me the most is that the command I posted above works when pasted directly into the terminal, but not the script. I am brand new to Shell/Bash scripting, so I'm sure it's some newbie thing that I'm missing, but if someone could point out what that is I would greatly appreciate it. Thanks!
EDIT To include Minimal Reproducible Example:
I have included my script with the URL changed to the Firefox download link. I have confirmed that once again, the command pasted into the terminal works perfectly but when run in the script it returns the above error.
#!/bin/sh
#
#download and extract agent
#
mkdir /tmp/AgentInstall
cd /tmp/AgentInstall
curl --output AgentInstall.zip https://www.mozilla.org/en-US/firefox/download/thanks/
unzip AgentInstall.zip
#
Error was caused by CRLF newlines instead of LF newlines. Thank you #Charles Duffy for your help!

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.

How do i access AWS SAM-CLI through bash on windows?

I am running Windows 10 and can only access AWS SAM through command prompt but not bash. When i try to use bash, i get a bash: sam: command not found error.
If it helps, I currently have installed AWS CLI v2 and have installed it via an MSI file.
Why am i not able to use SAM through bash?
Edit: Yes i am aware that it doesnt explicitly say that you can use bash on the AWS setup guide
Verify the installation.
After completing the installation, verify it by opening a new command prompt or PowerShell prompt. You should be able to invoke sam from the command line.
However, I still want to be able to use it through bash. Is there a workaround?
Do you tried sam.cmd?
Sometimes bash don't know how to execute .cmd files. Here is a thread with this problem.
You can try this solution too:
alias sam='sam.cmd'

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

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

Bash error after opening Terminal and running shell scripts (CentOS) [duplicate]

This question already has answers here:
Error message on Terminal launch [duplicate]
(2 answers)
Closed 6 years ago.
Every time I open Terminal in CentOS 6.4, I get the error:
bash: usr/local/bin: No such file or directory
I've checked .bashrc and .bash_profile to see if there are any lines that reference usr/local/bin, but haven't found anything. The same error also appears when I switch to root, or run a shell script.
Is it as simple as adding a backslash in front of usr? Like so--
/usr/local/bin
Still don't know where the error is happening though. Any help is much appreciated. Thanks!
This is strange as the normal bash directory on a centos 6.4 system is /bin/bash, however I would advise you to check the following:
echo $SHELL
It should pull your SHELL environment variable to show you where what shell you are using, normally it looks like this:
SHELL=/bin/bash
If it's different say for example:
SHELL=usr/local/bin/bash
then I would check your passwd file to make sure your users default shell is pointing to the right place.
username:x:601:601::/home/username:/bin/bash
Also I would suggest check where you shell actually lives
which bash
/bin/bash
And make sure everything is pointing to the correct location.

Resources