I have a script.sh with the following content:
#!/bin/bash
echo You Name:
read name
echo You Age:
read age
echo Name: $name, Age: $age.
Is it possible to pass the name and age variables to the read shell script with php?
asked Jun 8, 2017 at 9:47
Espector
4512 gold badges6 silver badges18 bronze badges
-
are tou created your .sh file using phpPraveen P K– Praveen P K2017年06月08日 09:50:41 +00:00Commented Jun 8, 2017 at 9:50
1 Answer 1
Yes you can Pass parameters to bash.
PHP:
$output = exec("./bashscript $name $age");
#!/bin/bash
Bash:
name=1ドル
age=2ドル
Reference: passing a variable from php to bash
answered Jun 8, 2017 at 9:55
NID
3,3241 gold badge21 silver badges29 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default