You have a few problems:
1) your PHP needs a space in the command $username = 'foo'; Exec('/root/test.sh ' . $username);
2) your shell script you need Echo $1
Ken
------Original Message------ From: aurfalien@gmail.com Sender: support-bounces@drupal.org To: support@drupal.org ReplyTo: support@drupal.org Subject: [support] passing vars Sent: Jun 27, 2009 5:41 PM
Hi,
Please excuse this seemingly retarded mail.
While fun, PHP is more then 4 handfuls and I only have 2.
An example php script;
$username = foo; exec('/root/script.sh'.($username));
My script.sh file;
#!/bin/tcsh mkdir /root/$username
When I execute my PHP script, I get this;
sh: /root/script.shfoo: No such file or directory
I was hoping to pass the PHP var of $username to mkdir in the tcsh script and make a directory called /root/foo.
I don't understand whats going on.
Any ideas?
- aurf -- [ Drupal support list | http://lists.drupal.org/ ]
Sent from my Verizon Wireless BlackBerry
Wow Ken, thanks very very much.
mkdir /root/$1 worked like a charm.
And I understand the need for the space.
- aurf On Jun 27, 2009, at 6:03 PM, Ken Robinson wrote:
You have a few problems:
- your PHP needs a space in the command
$username = 'foo'; Exec('/root/test.sh ' . $username);
- your shell script you need
Echo $1
Ken
------Original Message------ From: aurfalien@gmail.com Sender: support-bounces@drupal.org To: support@drupal.org ReplyTo: support@drupal.org Subject: [support] passing vars Sent: Jun 27, 2009 5:41 PM
Hi,
Please excuse this seemingly retarded mail.
While fun, PHP is more then 4 handfuls and I only have 2.
An example php script;
$username = foo; exec('/root/script.sh'.($username));
My script.sh file;
#!/bin/tcsh mkdir /root/$username
When I execute my PHP script, I get this;
sh: /root/script.shfoo: No such file or directory
I was hoping to pass the PHP var of $username to mkdir in the tcsh script and make a directory called /root/foo.
I don't understand whats going on.
Any ideas?
- aurf
-- [ Drupal support list | http://lists.drupal.org/ ]
Sent from my Verizon Wireless BlackBerry
[ Drupal support list | http://lists.drupal.org/ ]