h1

xgamma-rekin scripta

2008 martxoa 18

Bestean esan bezala, azkenean skriptxo txiki bat egin dut, xgamma erraz aldatzeko.

esdebian jendearen laguntzarekin


#!/bin/bash
# ##########################################
# Pantailaren distira aldatzeko skript-a
# Honen bidez xgamma komandoa erabiliz,
# pantailaren gamma 0.1 igotzea ala
# jaistea du helburu
#
# ERABILTZEKO:
# ./gama.sh + //Gammaren balioa 0.1 igotzeko
# ./gama.sh - //Gamaren balioa 0.1 jaisteko
#
# Copyright (C) 2008 Asier <athilha@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# ###########################################
# Parametro bakarra sartu dela egiaztatzen dut,
# bestela irteten naiz
if [ $# != 1 ]; then
exit 0
fi
#Parametro bakarra sartu badut, zuzena den egiaztatzen dut
if [ $1 = "+" ]; then
NORA=0
elif [ $1 = "-" ]; then
NORA=1
else
exit 0
fi
# xgammak itzultzen didana gordetzen dut VAR aldagaian
# xgamma-ren irteera stderr-etik stdout-era berbidaltzen du
VAR=`xgamma 2>&1`
# Beharrezkoak ditudan zenbakiak hartu eta oso eta dezimaletan banatzen ditut
NUM=${VAR:8:4}
DEC=${NUM:2:1}
INT=${NUM:0:1}
# 0 < gamma > 2 dela ziurtatzen naiz
if [ $INT = 2 ]; then
if [ $NORA = 0 ]; then
exit 0;
fi
elif [ $INT = 0 ]; then
if [ $DEC = 1 ]; then
if [ $NORA = 1 ]; then
exit 0
fi
fi
fi
# gorakorra izanez gero, dezimalak handitzen ditut
if [ $NORA = 0 ]; then
if [ $DEC = 9 ]; then
DEC=0
INT=$(($INT+1))
else
DEC=$(($DEC+1))
fi
else
# beherakoa izanez gero txikitu
if [ $DEC = 0 ]; then
DEC=9
INT=$(($INT-1))
else
DEC=$(($DEC-1))
fi
fi
GAMA=$INT.$DEC
# behin gamaren balio berria izanik, xgamma komandoa exekutatzen dut, -quiet parametroarekin
xgamma -q -gamma $GAMA

Advertisements

2 iruzkin

  1. […] more here: xgamma-rekin scripta Posted under Bez kategorii and tagged with aldatzeko-esdebian, azkenean-skriptxo, […]


  2. […] the original post: xgamma-rekin scripta Category: Bez kategorii Tags: aldatzeko-esdebian, azkenean-skriptxo, distira-aldatzeko, egin-dut, […]



Utzi erantzun bat

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Aldatu )

Twitter picture

You are commenting using your Twitter account. Log Out / Aldatu )

Facebook photo

You are commenting using your Facebook account. Log Out / Aldatu )

Google+ photo

You are commenting using your Google+ account. Log Out / Aldatu )

Connecting to %s

%d bloggers like this: