简体   繁体   English

如何使用php将参数传递到sh文件?

[英]How to pass parameters to sh file with php?

I'm executing this command: 我正在执行以下命令:

exec('sh myFile.sh paramater1')

But in myFile.sh , how to get parameter1 ? 但是在myFile.sh ,如何获取parameter1呢?

I didn't find any information about it 我没有找到任何相关信息

The command line parameters in shell are referenced as $1 , $2 , and so forth. shell中的命令行参数被引用为$1$2等。

As a side note: 附带说明:

  • $0 is the name of the command $ 0是命令的名称
  • $# is the total number of parameters $#是参数总数
  • $@ is all of the parameters $ @是所有参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM