L
L
lamer3502018-07-24 22:15:26
Command line
lamer350, 2018-07-24 22:15:26

How to find and replace a value in a file with a command in the terminal?

I almost never worked with the terminal, for convenience I want to create a script to disable opcache when necessary and enable it back!
The task is as follows:
There is a file php.iniin it, you need to change the value in the line opcache.enable=0to opcache.enable=1
After restart php
And if you can set the condition

if (opcache.enable==0){ opcache.enable=1; }else{ opcache.enable=0;}
that would be absolutely great!
Tried with SED but nothing works...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Doc44, 2018-07-24
@Doc44

https://habr.com/company/ruvds/blog/327530/
In particular

$ echo "This is a test" | sed 's/test/another test/'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question