Unix shell scripting: Full Log


Creating of a Shell Scripting full log.


#!/bin/bash -x

export Me=`basename $0 .sh`
{
export current_date=`date "+%Y-%m-%d_%H%M%S"`

#
echo "Me: $Me"
echo "Current Date: $current_date"
echo -e "Successful Job. \n\n\n"
exit 0

} > ${Me}".log1" 2> ${Me}".log2"



Results

full_log.log1
Me: full_log
Current Date: 2017-05-14_200038
Successful Job.

full_log.log2
++ date +%Y-%m-%d_%H%M%S
+ export current_date=2017-05-14_200038
+ current_date=2017-05-14_200038
+ echo 'Me: full_log'
+ echo 'Current Date: 2017-05-14_200038'
+ echo -e 'Successful Job. \n\n\n'
+ exit 0

Comentarios

Entradas populares de este blog

Configurar un Dominio en FreeBSD

Servidor DNS en FreeBSD

Sed: Extract a file's part with sed command