Linux 中 sh -c

 

001、

[root@PC1 test]# ls
a.sh
[root@PC1 test]# cat a.sh
#!/bin/bash
echo hello world
[root@PC1 test]# sh -c bash a.sh         ## 更新了系统环境变量?
(base) [root@PC1 test]#
(base) [root@PC1 test]# conda deactivate
[root@PC1 test]# ls
a.sh
[root@PC1 test]# sh -c 'bash a.sh'       ## 可以执行shell脚本
hello world
[root@PC1 test]# sh -c
sh: -c: option requires an argument
[root@PC1 test]# sh -c bash              ## 更新了系统环境变量

。 

 

实例:

cat population.list | nohup xargs -iF -P 3 sh -c 'nohup PopLDdecay -InVCF SNP.vcf -MaxDist 1000 -OutStat F -SubPop F'

 

ref:

01、https://zhuanlan.zhihu.com/p/684839586

 

posted @ 2025-03-08 10:22  小鲨鱼2018  阅读(53)  评论(0)    收藏  举报