DataArts Factory allows you to develop, debug, and run Shell scripts online. You can run developed scripts in jobs. For details, see Developing a Pipeline Job.
Parameter |
Description |
|---|---|
Host Connection |
Selects the host where a shell script is to be executed. |
Click Input Parameters and enter the parameter and interactive parameter for executing the shell script.
Parameter |
Description |
|---|---|
Parameter |
Parameter transferred to the Shell script when it is executed. Parameters are separated by spaces, for example, a b c. The parameter must be referenced by a location variable (for example, $1, $2, or $3) in the Shell script. Otherwise, the parameter is invalid. The location variable starts from 0. Variable 0 is reserved for storing the actual script name, variable 1 corresponds to the first parameter of the script, and so on. For example, $1, $2, and $3 reference parameters a, b, and c, respectively. Note: If a variable is referenced in the shell script, use the $args format instead of the ${args} format. Otherwise, the variable will be replaced by a parameter with the same name in the job. For example, if you enter a b c and run the following Shell script, b is displayed: echo $2 |
Interactive Parameter |
Interactive information (for example, passwords) provided during shell script execution. Interactive parameters are separated by spaces. The shell script reads parameter values in sequence according to the interaction situation. For example, run the following interactive Shell script. Interaction parameters 1, 2, and 3 correspond to begin, end, and exit, respectively.
#!/bin/bash select Actions in "begin" "end" "exit" do case $Actions in "begin") echo "start something" break ;; "end") echo "stop something" break ;; "exit") echo "exit" break ;; *) echo "Ignorant" ;; esac done The following is an example of using the read -p syntax: read -p "Parameter 1 and parameter 2"Variable 1 Variable 2 |
a=1
echo ${a}
In the preceding command, a indicates the parameter name. It can contain only letters, digits, hyphens (-), underscores (_), greater-than signs (>), and less-than signs (<), and can contain a maximum of 16 characters. The parameter name must be unique.
Note: If a variable is referenced in the shell script, use the $args format instead of the ${args} format. Otherwise, the variable will be replaced by a parameter with the same name in the job.
and click Release.
Parameter |
Mandatory |
Description |
|---|---|---|
Script Name |
Yes |
Name of the script. The name contains a maximum of 128 characters, including only letters, numbers, hyphens (-), underscores (_), and periods (.). |
Description |
No |
Description of the script |
Select Directory |
Yes |
Directory to which the script belongs. The root directory is selected by default. |
If you open an unsaved script, you can restore its content from the local cache.
After the script is saved, a version is automatically generated and displayed in Versions. The version can be rolled back. If you save a script multiple times within a minute, only one version is recorded. If the intermediate data is important, you can click Save new version to save and add a version.