当前位置:网站首页>RestCloud ETL解决shell脚本参数化
RestCloud ETL解决shell脚本参数化
2022-06-26 14:51:00 【RestCloud】
RestCloud ETL社区版是一款数据集成工具,提供可视化多数据管道构建、数据源管理、运行监控及权限管理功能。
RestCloud平台中如何将变量传入shell脚本中使用,平台中有两种方式运行shell脚本,分别是组件内编写脚本代码和调用脚本文件,根据不同的运行方式也有不同的获取变量的方式。
1.组件内编写脚本
组件内编写脚本的变量获取方式与其它组件获取变量的方式相同,使用${变量id}就可以获取到变量数据。如下图所示:
这里做个简单的流程,把数据库表中的某个字段数据作为变量逐条输入到shell脚本当中。
这里是数据库数据,流程中会将姓名作为变量。
库表输入组件的配置这边略过,简单的能够成功读取输出数据就行。
逐行输出这里需要将字段数据转成为变量数据输出到下一个节点。
这里是shell脚本配置,写个简单的脚本,使用${变量id}调用上个节点传入的变量数据。
运行之后可以看见已经成功通过${姓名}获取到了数据库输出的数据。
2.调用脚本文件
这个是调用已经写好的shell脚本文件,脚本文件中不用定义变量的名字,直接使用 $变量id 这种方式调用就可以成功调用流程中传入的变量。如下图:
这里同样采用上面的流程和数据库,只是稍微修改了一下shell组件的脚本内容。
因为是读取的脚本文件,这里需要填写一下脚本所在的目录。在shell脚本中运行文件以及使用${变量id}来获取变量即可,注意:若是多个变量就需要注意变量的顺序。
这里进入到文件所在目录后使用pwd查看当前所在的路径地址。
使用vim 文件名称 进入脚本文件编辑脚本代码,这里简单的打印第一个变量和一个hello,在文件中使用$1~$n来添加传到Shell的变量值。$1是第1变量、$2是第2变量…。
配置完成,运行后查看结果。
可以看到shell成功获取了变量数据,输出到了日志中。
感谢您对我们的关注和支持!如需了解更多的功能,请加入RestCloud ETL社区免费下载体验,下载地址:https://etl.restcloud.cn
边栏推荐
- 【云原生】 ”人人皆可“ 编程的无代码 iVX 编辑器
- Informatics Olympiad all in one 1400: count the number of words (string matching)
- Naacl2022: (code practice) good visual guidance promotes better feature extraction, multimodal named entity recognition (with source code download)
- R语言dplyr包bind_rows函数把两个dataframe数据的行纵向(竖直)合并起来、最终行数为原来两个dataframe行数的加和(Combine Data Frames)
- 券商经理给的开户链接办理股票开户安全吗?我想开个户
- Optimizing for vectorization
- [async/await] - the final solution of asynchronous programming
- Stream常用操作以及原理探索
- Is it safe to open a stock account with the account manager online??
- 券商经理给的开户二维码安全吗?找谁可以开户啊?
猜你喜欢
Login authentication service
北京银行x华为:网络智能运维夯实数字化转型服务底座
程序分析与优化 - 8 寄存器分配
Halcon C # sets the form font and adaptively displays pictures
Document 1
使用 Abp.Zero 搭建第三方登录模块(二):服务端开发
Mark一下 Unity3d在Inspector中选中不了资源即Project锁定问题
Where do people get their top energy?
Naacl2022: (code practice) good visual guidance promotes better feature extraction, multimodal named entity recognition (with source code download)
文献1
随机推荐
The heavyweight white paper was released. Huawei continues to lead the new model of smart park construction in the future
Oracle11g database import and export method tutorial [easy to understand]
Solution to the upper limit of TeamViewer display devices
Principle of TCP reset attack
信息学奥赛一本通 1405:质数的和与积 (思维题)
The intersect function in the dplyr package of R language obtains the data lines that exist in both dataframes and the data lines that cross the two dataframes
R language dplyr package summary_ The at function calculates the mean and median of multiple data columns (specified by vectors) in the dataframe data, and specifies na RM parameter configuration dele
Combat readiness mathematical modeling 32 correlation analysis 2
[solo π] ADB connects multiple mobile phones
网上找客户经理办理股票开户安全吗??
打新债注册开户安全吗,有没有什么风险?
Practical website recommendations worth collecting for College Students
Is the account opening link given by the broker manager safe? Who can I open an account with?
券商经理给的开户链接安全吗?找谁可以开户啊?
R language GLM function logistic regression model, using epidisplay package logistic The display function obtains the summary statistical information of the model (initial and adjusted odds ratio and
同花顺注册开户安全吗,有没有什么风险?
备战数学建模30-回归分析2
[async/await] - the final solution of asynchronous programming
teamviewer显示设备数量上限解决方法
券商经理给的开户二维码安全吗?找谁可以开户啊?