found the solution, but not the problem :-D

cecho()
{
        if [ "$1" = "black" ]; then
                open="\033[30m"
        elif [ "$1" = "red" ]; then
                open="\033[31m"
        elif [ "$1" = "green" ]; then
                open="\033[32m"
        elif [ "$1" = "yellow" ]; then
                open="\033[33m"
        elif [ "$1" = "blue" ]; then
                open="\033[34m"
        elif [ "$1" = "magenta" ]; then
                open="\033[35m"
        elif [ "$1" = "cyan" ]; then
                open="\033[36m"
        fi
        
        echo "$open $2 $3"
        tput sgr0
}

cecho "green" "running processes: "

This will work :-P

Jelle de Jong wrote:
> I found a way to upgrade to edgy with my epia en12000, more on that later.
> 
> But I have a lot of script that i use and a common function for echoing
> colour is:
> 
> cecho()
> {
>       if [ "$1" = "black" ]; then
>               echo -ne "\E[30m"
>       elif [ "$1" = "red" ]; then
>               echo -ne "\E[31m"
>       elif [ "$1" = "green" ]; then
>               echo -ne "\E[32m"
>       elif [ "$1" = "yellow" ]; then
>               echo -ne "\E[33m"
>       elif [ "$1" = "blue" ]; then
>               echo -ne "\E[34m"
>       elif [ "$1" = "magenta" ]; then
>               echo -ne "\E[35m"
>       elif [ "$1" = "cyan" ]; then
>               echo -ne "\E[36m"
>       fi
> 
>       echo $2 $3
>       tput sgr0
> }
> 
> cecho "green" "text in green - running processes:"
> 
> this should work and in a script it also work when I run in directly
> from xterm or xfce4-terminal.
> 
> But in a thunar launcher or custom action it does not work and screws up
> the script. It is getting very frustrating because I can't find the problem.
> 
> I have attached two files a script and a launcher,
> 
> Please help.
> 

-- 
xubuntu-devel mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/xubuntu-devel

Reply via email to