OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [branches/] [verilator/] [utils/] [setup/] [beautify.sh] - Blame information for rev 141

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 76 rfajardo
#!/bin/bash
2
# Xanthopoulos Constantinos
3
# Some useful function for my scripts
4
 
5
function cecho
6
{
7
         echo -e "\033[1m\033[33m$1\033[0m"
8 114 rfajardo
         echo -e "\033[1m\033[33m$1\033[0m" >> ${SCRIPT_DIR}/progress.log
9 76 rfajardo
}
10
 
11
function cnecho
12
{
13
         echo -e -n "\033[0m\033[33m$1\033[0m"
14 114 rfajardo
         echo -e -n "\033[0m\033[33m$1\033[0m" >> ${SCRIPT_DIR}/progress.log
15 76 rfajardo
}
16
 
17
function errormsg
18
{
19
        echo -e "\033[1m\033[31mError: $1\033[0m\n";
20 114 rfajardo
        echo -e "\033[1m\033[31mError: $1\033[0m\n" >> ${SCRIPT_DIR}/error.log
21 76 rfajardo
        exit 1;
22
}
23
 
24
function _execcmd
25
{
26
    # Print Message
27 114 rfajardo
    echo -e "\033[35m$1...\033[0m\n" >> ${SCRIPT_DIR}/progress.log
28 81 rfajardo
    if [ -n "$1" ]
29
    then
30
        echo -e -n "\033[35m$1...\033[0m"
31
    fi
32 76 rfajardo
    # Execute command
33
    if [ $DEBUG -ne 1 ];
34
    then
35 114 rfajardo
        eval $2 1>>${SCRIPT_DIR}/progress.log 2>>${SCRIPT_DIR}/error.log;
36 76 rfajardo
    fi;
37
    # Check Execution
38
    if [ $? -eq 0 ]
39
    then
40
        if [ -n "$1" ]
41
        then
42 81 rfajardo
            echo -e "\033[32mcomplete\033[0m";
43 114 rfajardo
            echo -e "\033[32mcomplete\033[0m" >> ${SCRIPT_DIR}/progress.log
44 76 rfajardo
        fi
45
    else
46
        errormsg "Command: $2 Description: $1";
47
        exit 1;
48
    fi
49
}
50
 
51
function execcmd
52
{
53
    if [ -z "$2" ]
54
    then
55
        _execcmd "" "$1"
56
    else
57
        _execcmd "$1" "$2"
58
    fi
59
}
60
 
61
if [ $DEBUG -eq 1 ]
62
then
63
    cecho "Debug mode on! Nothing will actually run";
64
fi

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.