我是靠谱客的博主 秀丽电源,这篇文章主要介绍sed 替换 bash shell 可变参数,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
#!/bin/bash var=$1 cp ./cat_web_tpl ./cat_web.yaml sed -i "s/###/${var}/g" ./cat_web.yaml cat ./cat_web.yaml sleep 1 ansible-playbook ./cat_web.yaml

cat_web_tpl

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
--- - hosts: web vars: cat4: "cat /var/www/log/php-errors.log|grep Fatal" clean: "ls -lh /var/www/log; echo '' > /var/www/log/php-errors.log;" remote_user: centos become: true become_user: root tasks: - name: cmd shell: "{{ ### }}" register: out - debug: var=out.stdout_lines

最后

以上就是秀丽电源最近收集整理的关于sed 替换 bash shell 可变参数的全部内容,更多相关sed内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部