P
P
PowerUSB2018-03-19 14:50:44
bash
PowerUSB, 2018-03-19 14:50:44

How to write the result of BASH script execution to a log file?

Hello.
I re-read a lot of material on the Internet, but I still didn’t understand how to write the result of the bash script to a log file (roughly speaking, writing everything that is output to the console after running the bash script.
My script is as follows:

for ((i=2; i<=$1 ; i++));
do 	
  php /var/www/powerusb/data/gamerobot/robot.php $i &
done

What do I need to add to the script to make the entry?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
falsebyte, 2018-03-19
@falsebyte

Try like this:

for ((i=2; i<=$1 ; i++));
do 	
  php /var/www/powerusb/data/gamerobot/robot.php $i >> /tmp/robot.$i 2>&1 &
done

P
pfg21, 2018-03-19
@pfg21

adyn option: script.sh > log
option two: man script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question