LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-27-2009, 11:09 AM   #1
Karas
Member
 
Registered: Oct 2009
Distribution: Slackware 13.0
Posts: 49

Rep: Reputation: 15
echo variables into config file.


Ok, so I have a wp-config.php file, (word press configuration php script) and it needs information regarding the user, mainly mysql username and password.

I have a script that sets up the users database and password for mysql, is there anyway I can copy the wp-config.php file to the newly created users wordpres dir with the variables for their mysql account inside of the wp-config.php?

At a guess I would imagine something like this :-

Quote:
#Script to make new users..

#Part that makes MySQL account
password=`mkpass -s 0 -l 14`
mysql -u root -e
"create user $user;
create database $user;
grant privileges on $user.* to $user@localhost;
flush;"

echo $user > wp-config.php where $user exists
echo $password > wp-config where $password exists
Just a guess,...
 
Old 11-27-2009, 12:15 PM   #2
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 673

Rep: Reputation: 94
Quote:
Originally Posted by Karas View Post

At a guess I would imagine something like this :-



Just a guess,...
try man sed. it will do what you need as changing string where found based on a specified sed script (don't worry it will be a command)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Edgy where is the config file where xset variables can be set as permanent? jim0112 Ubuntu 2 10-01-2007 02:27 PM
how to echo whole string to a file? dwarf007 Linux - General 5 06-20-2007 04:44 AM
How do I echo to both standard out and to a file? Br. Nicholas Linux - General 11 10-12-2004 04:09 PM
How to echo variables and commands in one line? hindll01 Programming 1 09-10-2004 07:02 AM
echo data in to a file xlord Linux - Newbie 3 05-29-2004 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration