Execute bash script from URL: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
== What is Bash? ==
== What is Bash? ==
'''[[wikipedia:Bash (Unix shell)|Bash]]''' is a "Unix shell": a command line interface for interacting with the operating system. It is widely available, being the default shell on many GNU/Linux distributions and on Mac OSX, with ports existing for many other systems. It was created in the late 1980s by a programmer named Brian Fox, working for the [[wikipedia:Free Software Foundation|Free Software Foundation]].  It was intended as a free software alternative to the Bourne shell (in fact, its name is an acronym for ''Bourne Again SHell''), and it incorporates all features of that shell, as well as new features such as integer arithmetic and job control
'''[[wikipedia:Bash (Unix shell)|Bash]]''' is a "Unix shell": a command line interface for interacting with the operating system. It is widely available, being the default shell on many GNU/Linux distributions and on Mac OSX, with ports existing for many other systems. It was created in the late 1980s by a programmer named Brian Fox, working for the [[wikipedia:Free Software Foundation|Free Software Foundation]].  It was intended as a free software alternative to the Bourne shell (in fact, its name is an acronym for ''Bourne Again SHell''), and it incorporates all features of that shell, as well as new features such as integer arithmetic and job control
__TOC__


== Shell scripting ==
== Shell scripting ==
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash (like many other shells) also has the ability to run an entire script of commands, known as a "Bash shell script" (or "Bash script" or "shell script" or just "script"). A script might contain just a very simple list of commands — or even just a single command — or it might contain functions, loops, conditional constructs, and all the other hallmarks of imperative programming. In effect, a Bash shell script is a computer program written in the Bash programming language.
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash (like many other shells) also has the ability to run an entire script of commands, known as a "Bash shell script" (or "Bash script" or "shell script" or just "script"). A script might contain just a very simple list of commands — or even just a single command — or it might contain functions, loops, conditional constructs, and all the other hallmarks of imperative programming. In effect, a Bash shell script is a computer program written in the Bash programming language.


''Shell scripting is the art of creating and maintaining such scripts. Shell scripts can be called from the interactive command-line described above; or, they can be called from other parts of the system. One script might be set to run when the system boots up; another might be set to run every weekday at 2:30 AM; another might run whenever a user logs into the system.''
''Shell scripting is the art of creating and maintaining such scripts. Shell scripts can be called from the interactive command-line described above; or, they can be called from other parts of the system. One script might be set to run when the system boots up; another might be set to run every weekday at 2:30 AM; another might run whenever a user logs into the system.''


== Bash from URL ==
== Bash from URL ==
Most recently it's become the common fashion to execute bash script from URL. Where scripts were hosted in a centralized server and anybody could access and execute it using HTTP. It's little bit tricky but very easy to update, maintains and execute from a common place. You can maintains the version for backward compatibility
It's become very convenient process to execute bash script from URL. Where scripts were hosted in a centralized server, any '''HTTP Client''' could access and execute it. It's little bit tricky but very much easy to update, maintains and execute from a centralized '''HTTP Server'''. In case of backward compatibility it could be maintains by the script version. For example:
 
'''Chorke, Inc.''' need to maintains a big size of Open Source Community. It's community demand to keep them up to date with the CI(Continuous Integration) and CD(Continuous Deployment). By which it will be reduce the difficulties, simplified teamwork and contribution to '''Chorke, Inc.'''. This community challenges overcomes by it's official bash script page as following:
 
<syntaxhighlight lang="bash">
# using curl from http://cdn.chorke.org/bash
bash <(curl -s  'http://cdn.chorke.org/bash/zend/pull')
 
# using wget from http://cdn.chorke.org/bash
bash <(wget -qO- 'http://cdn.chorke.org/bash/zend/pull')
</syntaxhighlight>
 
Most of the '''Bash script from URL''' guide you to use the convention as below. It's good enough for none interactive mode. If your demand to use your script in interactive mode then should follow as the instruction of above.
 
<syntaxhighlight lang="bash">
# using curl from http://cdn.chorke.org/bash
curl -s  'http://cdn.chorke.org/bash/zend/pull' | bash
 
# using wget from http://cdn.chorke.org/bash
wget -qO- 'http://cdn.chorke.org/bash/zend/pull' | bash
</syntaxhighlight>
 
'''Another convention may be used by own risk'''.
 
<syntaxhighlight lang="bash">
# using curl from http://cdn.chorke.org/bash
source <(curl -s  'http://cdn.chorke.org/bash/zend/pull')
 
# using wget from http://cdn.chorke.org/bash
source <(wget -qO- 'http://cdn.chorke.org/bash/zend/pull')
</syntaxhighlight>


It's way to hosting bash script any online server.
It's might be causes termination the working console.
This is the official home page of Chorke, Inc.'s bash script creator. This page guide you how to run remote bash script locally according to your project nature. This site is responsible for keep your scripts up to date. By which you will be remain updated with the continuous integration, build and deployment systems. We are trying to provide our best effort to reduce the difficulties, simplified teamwork and contribution to Chorke, Inc.

Latest revision as of 02:50, 5 January 2018

What is Bash?

Bash is a "Unix shell": a command line interface for interacting with the operating system. It is widely available, being the default shell on many GNU/Linux distributions and on Mac OSX, with ports existing for many other systems. It was created in the late 1980s by a programmer named Brian Fox, working for the Free Software Foundation. It was intended as a free software alternative to the Bourne shell (in fact, its name is an acronym for Bourne Again SHell), and it incorporates all features of that shell, as well as new features such as integer arithmetic and job control


Shell scripting

In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash (like many other shells) also has the ability to run an entire script of commands, known as a "Bash shell script" (or "Bash script" or "shell script" or just "script"). A script might contain just a very simple list of commands — or even just a single command — or it might contain functions, loops, conditional constructs, and all the other hallmarks of imperative programming. In effect, a Bash shell script is a computer program written in the Bash programming language.

Shell scripting is the art of creating and maintaining such scripts. Shell scripts can be called from the interactive command-line described above; or, they can be called from other parts of the system. One script might be set to run when the system boots up; another might be set to run every weekday at 2:30 AM; another might run whenever a user logs into the system.

Bash from URL

It's become very convenient process to execute bash script from URL. Where scripts were hosted in a centralized server, any HTTP Client could access and execute it. It's little bit tricky but very much easy to update, maintains and execute from a centralized HTTP Server. In case of backward compatibility it could be maintains by the script version. For example:

Chorke, Inc. need to maintains a big size of Open Source Community. It's community demand to keep them up to date with the CI(Continuous Integration) and CD(Continuous Deployment). By which it will be reduce the difficulties, simplified teamwork and contribution to Chorke, Inc.. This community challenges overcomes by it's official bash script page as following:

# using curl from http://cdn.chorke.org/bash
bash <(curl -s   'http://cdn.chorke.org/bash/zend/pull')

# using wget from http://cdn.chorke.org/bash
bash <(wget -qO- 'http://cdn.chorke.org/bash/zend/pull')

Most of the Bash script from URL guide you to use the convention as below. It's good enough for none interactive mode. If your demand to use your script in interactive mode then should follow as the instruction of above.

# using curl from http://cdn.chorke.org/bash
curl -s   'http://cdn.chorke.org/bash/zend/pull' | bash

# using wget from http://cdn.chorke.org/bash
wget -qO- 'http://cdn.chorke.org/bash/zend/pull' | bash

Another convention may be used by own risk.

# using curl from http://cdn.chorke.org/bash
source <(curl -s   'http://cdn.chorke.org/bash/zend/pull')

# using wget from http://cdn.chorke.org/bash
source <(wget -qO- 'http://cdn.chorke.org/bash/zend/pull')

It's might be causes termination the working console.