Wednesday, 2 November 2011

Echo Bash Variable to create PHP file.

Echo Bash Variable to create PHP file.

Hey,

I got stuck coding a small bash script which creates a php file.

This is what I have so far but it seems not to be working:
Code:

#!/bin/bash
userid=</dev/urandom tr -dc A-Za-z0-9 | head -c 16
passid=</dev/urandom tr -dc A-Za-z0-9 | head -c 24
echo '<?php
$tempuid = "$userid";
$temppid = "$userid";
//php actions below.
?>' > userpass.php

When I edit userpass.php I see:
PHP Code:

<?php
$tempuid 
"";
$temppid "";
//php actions below.
?>

Instead of the value of the variables.

Thanks

No comments:

Post a Comment