Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-27-2009, 10:09 AM   #1
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 :-

#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;

echo $user > wp-config.php where $user exists
echo $password > wp-config where $password exists
Just a guess,...
Old 11-27-2009, 11:15 AM   #2
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
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)


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 01:27 PM
how to echo whole string to a file? dwarf007 Linux - General 5 06-20-2007 03:44 AM
How do I echo to both standard out and to a file? Br. Nicholas Linux - General 11 10-12-2004 03:09 PM
How to echo variables and commands in one line? hindll01 Programming 1 09-10-2004 06:02 AM
echo data in to a file xlord Linux - Newbie 3 05-29-2004 12:19 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:06 AM.

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