Reputation: 451
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?
Upvotes: 1
Views: 98
Reputation: 3294
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
Upvotes: 1