当前位置:网站首页>【ansible】ansible shell 执行远程命令遇到awk 中$符号的问题
【ansible】ansible shell 执行远程命令遇到awk 中$符号的问题
2022-07-28 16:24:00 【kiraraLou】
前言
在使用ansible 配合awk 命名时报错。
原命令:
ansible presto -m shell -a "ps -ef|grep -i presto |grep -v grep|awk '{print $2}' |xargs jstack |grep JNI"
提取presto进程pid回失败,原因是ansible 设别awk的$ 符号有问题
解决方案:
将 $ 符号进行转义
ansible presto -m shell -a "ps -ef|grep -i presto |grep -v grep|awk '{print \$2}' |xargs jstack |grep JNI"
或者把命令写成脚本,远程执行脚本
边栏推荐
猜你喜欢

Source code of voice live broadcast app

Ugui learning notes (II) Scrollview related

使用阿里云免费的SSL证书

Azure Devops developed by visual studio 2015 team

Using SQL server agent job to restore the database regularly

线性代数及矩阵论(九)

零基础利用Unity3D开发AR应用并远程下载3D模型

Proof of the third scene (f) in 22 years

What does the service grid that has been popular for two years bring to microservices? (Reprinted)

Round 1A 2022 - Code jam 2022 c.weightlifting (interval DP)
随机推荐
Verilog 每日一题 (VL5 信号发生器)
Atcoder regular contest 133 d.range XOR (digital dp+ classification discussion)
Unity shader cartoon style rendering
Role of Fortress machine
C#遍历集合
Round 1C 2022 - Code jam 2022 b.square (Mathematics, thinking)
Shopee code League 2022 - qualification round p3.connecting the numbers (segment tree / bipartite graph determination, to be discussed)
C # traversal set
The 2021 ICPC ASIA Taipei Regional programming contest L. leadfoot (combinatorics /2-adic assignment function +kummer theorem)
wpf命令按钮透明样式
创建自定义分页控件
Verilog daily question (vl29 single port RAM)
The practice of the beego framework for goweb development: Section V project construction and user registration
Games101 assignment04 job 04
Cf/atc/lc topic score website
The practice of beego framework developed by goweb: Section 4 database configuration and connection
一文了解 Kubernetes 中的服务发现
Learn about service discovery in kubernetes
WPF command button transparent style
Fine-grained Fact Verification with Kernel GA Network