ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, it's my first post in this forum.I just started bash programming to automate some things on my server. I've done about half of the job but I'm stuck with two issues because i'm not experienced.
1. I want to use sed to read a file and run the commands in that file.Basically I want to compile php but because configure param take multiple lines i put them in a separate file. Now from a script, lest's call it web.sh i want to read all param of php, from php_conf.txt, and run it. How do i do that ?
2. I want to read all lines from a separate file and append to an existing file, at the end, and then save it. For example I have the file bash_conf.txt and want all the lines from it to be appended, at the end, to file bash.txt and then save the file. How do i do that ?
<<EDit: Wim is faster than I am-----and also much more succinct!>>
Is this homework?
Quote:
I want to use sed to read a file and run the commands in that file
SED can run it's own syntax from a file---is that what you mean? (See this for the -f option to SED: http://www.grymoire.com/Unix/Sed.html#uh-16 More generally, that site is the best SED tutorial)
Quote:
Basically I want to compile php but because configure param take multiple lines i put them in a separate file. Now from a script, lest's call it web.sh i want to read all param of php, from php_conf.txt, and run it. How do i do that ?
Is this related to the SED question? Regardless, you do not "compile PHP". PHP is a server-side scripting language.
Quote:
I want to read all lines from a separate file and append to an existing file, at the end, and then save it.
Take a look at the "cat" command and also at the redirection operators ">" and ">>".
If you don't have it already, go to http://tldp.org and get the Bash Guide for Beginners.
<<EDit: Wim is faster than I am-----and also much more succinct!>>
Is this homework?
SED can run it's own syntax from a file---is that what you mean? (See this for the -f option to SED: http://www.grymoire.com/Unix/Sed.html#uh-16 More generally, that site is the best SED tutorial)
Is this related to the SED question? Regardless, you do not "compile PHP". PHP is a server-side scripting language.
Take a look at the "cat" command and also at the redirection operators ">" and ">>".
If you don't have it already, go to http://tldp.org and get the Bash Guide for Beginners.
Good luck and Welcome to LQ!!
What ? What do you mean "you don't compile php" ? If i'm wrong here maybe php.net is wrong also and half of the internet. Perhaps "install php from sources" is more apropriate but "compile php from sources" is definately not wrong.
Even if is my first post here I'm not a noob and this is not my homework.I'm not very experienced with linux, I'm a noob in bash, but please don't treat me with superiority, trust me is not the case. No offense, maybe I misunderstood but I'm having the impression that you're ironic.
Sturkenboom thank you.
pixellany also thank you for the links
I mis-read "compile PHP" to mean "compile PHP code"----Sorry. I don't know why you need to install PHP from source, but you obviously know more about PHP than I do.
Quote:
I'm having the impression that you're ironic.
What does this mean? "Ironic" is not normally used as an attribute for a person.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.