我试过这个:
- command: ./configure chdir=/src/package/
- command: /usr/bin/make chdir=/src/package/
- command: /usr/bin/make install chdir=/src/package/
Run Code Online (Sandbox Code Playgroud)
哪个有效,但我想还有更多......整洁.
所以我尝试了这个:
来自:https://stackoverflow.com/questions/24043561/multiple-commands-in-the-same-line-for-bruker-topspin,它给了我"没有这样的文件或目录"
- command: ./configure;/usr/bin/make;/usr/bin/make install chdir=/src/package/
Run Code Online (Sandbox Code Playgroud)
我也尝试了这个:https://u.osu.edu/hasnan.1/2013/12/16/ansible-run-multiple-commands-using-command-module-and-with-items/
但我找不到合适的语法:
- command: "{{ item }}" chdir=/src/package/
with_items:
./configure
/usr/bin/make
/usr/bin/make install
Run Code Online (Sandbox Code Playgroud)
这不起作用,说有一个引用问题.
任何人?
有人可以向我解释这三个块之间的区别:
1 -> (.*)
2 -> (.*?)
3 -> .*
Run Code Online (Sandbox Code Playgroud)
据我所知,?使最后一个字符可选,为什么要把它?和为什么不把括号放在最后呢?
这来自这里:http://www.tutorialspoint.com/python/python_reg_expressions.htm
1st example : searchObj = re.search( r'(.*) are (.*?) .*', line, re.M|re.I)
Run Code Online (Sandbox Code Playgroud) 有没有办法在 networkx 中声明这个简单的图:
simple_graph = {
'A': ['B'],
'B': ['A', 'C', 'D'],
'C': ['A'],
'D': ['E', 'A', ''],
'E': ['B', '']
}
Run Code Online (Sandbox Code Playgroud)
以比这更简单的方式(更紧凑):
g.add_edges_from([('A', 'B'), ('B', 'A'), ('B', 'C'), ('B', 'D'),
('C', 'A'), ('D', 'E'), ('D', 'A'), ('E', 'B')])
Run Code Online (Sandbox Code Playgroud)
或不 ?