命令行子shell 括号 ()

子shell 控制变量

ansible-direc:~ # (export hello=world;echo $hello)
world
ansible-direc:~ # echo $hello

ansible-direc:~ #

实例: 不用单独更改权限,局部变量生效创建ca证书的私钥

ansible-direc:/etc/pki/CA # (umask 077;openssl genrsa -out private/cakey.pem 2048)
Generating RSA private key, 2048 bit long modulus
.+++
.........................................................................+++
e is 65537 (0x10001)

原文地址:https://www.cnblogs.com/liujianzuo888/p/5229106.html