Text slave EN

Aus Info-Theke
Version vom 26. Juni 2021, 06:04 Uhr von Hamatoma (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „= Purpose = The command line program text_slave "understand" the same commands as the GUI program text_butler. == Usage == There are three modes to start text…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Purpose[Bearbeiten]

The command line program text_slave "understand" the same commands as the GUI program text_butler.

Usage[Bearbeiten]

There are three modes to start text_slave:

text_slave --help
# writes a usage message to stdout.
text_slave
# reads the commands from stdin and writes the buffer "output" to stdout (after execution of that commands)
text_slave FILE
# reads the commands from the file '''FILE''' and writes the buffer "output" to stdout (after execution of that commands)

Example 1[Bearbeiten]

We use the mode "reading from stdin":

text_slave <<'EOS'
# load the settings into buffer "data":
load file="/etc/php/7.3/php.ini" output=data
# load the search expression of the interesting settings into buffer "regexpr":
copy text="^(memory_limit|upload_max_filesize|max_file_uploads|post_max_size|"
copy text="max_execution_time|max_input_time|default_socket_timeout)" output=regexpr append
copy text=i~"== previous values~n"
# log the current data of some variables (settings):
filter input=data append regexpr=i~"~[regexpr]~"
# replace some settings:
replace input=data output=data regexpr=/^(memory_limit\s*=\s*).*$/ with="%group1%2048M"
replace input=data output=data regexpr=/^(upload_max_filesize\s*=\s*).*$/ with="%group1%512M"
replace input=data output=data regexpr=/^(max_file_uploads\s*=\s*).*$/ with="%group1%100"
replace input=data output=data regexpr=/^(max_execution_time\s*=\s*).*$/ with="%group1%600"
replace input=data output=data regexpr=/^(max_input_time\s*=\s*).*$/ with="%group1%600"
replace input=data output=data regexpr=/^(default_socket_timeout\s*=\s*).*$/ with="%group1%600"
copy text=i~"~n== current values~n" output=mylog append
# log the current settings:
filter input=data append regexpr=i~"~[regexpr]~"
save 
EOS

Note: the data stored in buffer "output" is displayed automatically after executing the commands.