[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Logging of commands in a bash script to a file

Hi, Tom.

On Tuesday, 22 April 2014 23:18:30 +0100,
Tom Furie wrote:

> > I'm writing a bash script that runs several routing commands. I would
> > like these commands, on a part of the script, plus run, are saved to a
> > log file.

> I'm having trouble processing this paragraph. Are you saying that you
> want to run a script and have the commands within the script (and their
> output) recorded in another file?

What I meant is to have a group of commands in a script that, in
addition to being executed, I want these commands are stored in a log. I
will give an example to clarify. My script has the following lines

$IP route add ${VPN_NET[$N]} dev ${VPN_IFACE[$N]} src ${VPN_IP[$N]} table $N
$IP route add default via ${VPN_GW[$N]} table $N

$IP route add ${VPN_NET[$N]} dev ${VPN_IFACE[$N]} src ${VPN_IP[$N]}
$IP rule add from ${VPN_IP[$N]} table $N

Then, I want those four lines to be executed and then each line is
copied to a file with the appropriate substitutions.

Thanks for responding.

Best regards,
Ing. Daniel Bareiro - GNU/Linux registered user #188.598
Proudly running Debian GNU/Linux with uptime:
19:47:01 up 75 days, 22:13, 18 users,  load average: 1,13, 1,12, 1,14

Attachment: signature.asc
Description: Digital signature

Reply to: