Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 147def31eb
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (44 sloc) 1.501 kb
#!/bin/bash
# Copyright (C) Pedro Nicolás 2011 <png1981@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 <http://www.gnu.org/licenses/>.
# ______________________________________________________________________________
#
# Funciones generales usadas en mis scritps
#
# Versión: 0.1
# ______________________________________________________________________________
# se le pasa un fichero y te devuelve la extensión
function get_extension
{
echo "$1"|awk -F . '{print $NF}'
}
function get_basename
{
EXT=$(get_extension "$1")
BASENAME=$(basename "$1" .$EXT)
echo $BASENAME
}
# tiene que llegar sin el / final
# TODO podríamos mejorar este punto, eliminando el /, pero ahora no tengo ganas
function get_profundidad_directorio
{
echo $((`echo $1|sed 's/[^\/]//g'|wc -m`-1))
}
# si $1 era distinto de cero, error y salimos
function log_error_exit
{
if [ $1 != 0 ]; then
echo "ERROR: $2***"
exit 1
fi
}
Jump to Line
Something went wrong with that request. Please try again.