A requirement description
When I execute a.sh, I pass in a parameter, because b.sh also needs to quote the parameter, so I want to pass the parameter to b.sh.
Second, use export to achieve
[root@Centos7-Mode-V7 opt]# cat a.sh
export passwd0=$(echo $1)
sh /opt/b.sh
[root@Centos7-Mode-V7 opt]# cat b.sh
echo $passwd0
- Effects
[@ Centos7 the root-Mode-V7 opt] # SH a.sh Hi
Hi