<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Apéndice K. Script para convertir a mayúsculas el archivo pasado como argumento</title><link rel="stylesheet" href="./estilo.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.64.1" /><link rel="home" href="index.html" title="Integración de redes con OpenLDAP, Samba, CUPS y PyKota" /><link rel="up" href="apendice-otros-archivos.html" title="Parte V. Misceláneo" /><link rel="previous" href="smbldap-tools-mkntpasswd.html" title="J.3. Instalación de mkntpwd" /><link rel="next" href="mover-controladores.html" title="Apéndice L. Script para mover los controladores PostScript de Adobe al directorio&#10;&#9;/usr/share/cups/drivers" /><meta xmlns="http://www.w3.org/TR/xhtml1/transitional" name="generator" content="Experimental LDP.XSL $Revision: 1.3 $"></meta>
  <!-- Generated by LDP XSLT customization layer
      based on Norman Walsh's DocBook XSL stylesheets.
      More information at http://www.linuxdoc.org/ -->
  </head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Apéndice K. Script para convertir a mayúsculas el archivo pasado como argumento</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="smbldap-tools-mkntpasswd.html">Anterior</a> </td><th width="60%" align="center">Parte V. Misceláneo</th><td width="20%" align="right"> <a accesskey="n" href="mover-controladores.html">Siguiente</a></td></tr></table><hr /></div><div class="appendix" lang="es" xml:lang="es"><div class="titlepage"><div><div><h2 class="title"><a id="uppercase"></a>Apéndice K. Script para convertir a mayúsculas el archivo pasado como argumento</h2></div></div><div></div></div><p>El script que se lista a continuación, convierte el archivo pasado como
	argumento a mayúsculas.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="./imagenes/note.png" /></td><th align="left">Nota</th></tr><tr><td colspan="2" align="left" valign="top"><p>Este script se ha adaptado a partir del archivo de ejemplo
	<tt class="filename">/usr/share/doc/bash/examples/scripts.v2/lowercase</tt> que se
	distribuye con el paquete <i class="emphasis">bash</i>.</p></td></tr></table></div><table xmlns="http://www.w3.org/TR/xhtml1/transitional" border="0" bgcolor="#E0E0E0" width="90%"><tr><td><pre class="programlisting">#! /bin/bash
#
# original from
# @(#) lowercase.ksh 1.0 92/10/08
# 92/10/08 john h. dubois iii (john@armory.com)
#
# conversion to bash v2 syntax done by Chet Ramey
#
# Convert to uppercase by Sergio González González
#

Usage="Usage: $name file ..."
phelp()
{
echo "$name: change filenames to upper case.
$Usage
Each file is moved to a name with the same directory component, if any,
and with a filename component that is the same as the original but with
any lower case letters changed to upper case."
}

name=${0##*/}

while getopts "h" opt; do
	case "$opt" in
	h)	phelp; exit 0;;
	*)	echo "$Usage" 1&gt;&amp;2; exit 2;;
	esac
done

shift $((OPTIND - 1))

for file; do
    filename=${file##*/}
    case "$file" in
    */*)    dirname=${file%/*} ;;
    *)    dirname=. ;;
    esac
    nf=$(echo $filename | tr a-z A-Z)
    newname="${dirname}/${nf}"
    if [ "$nf" != "$filename" ]; then
	mv "$file" "$newname"
	echo "$0: $file -&gt; $newname"
    else
	echo "$0: $file not changed."
    fi
done</pre></td></tr></table></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="smbldap-tools-mkntpasswd.html">Anterior</a> </td><td width="20%" align="center"><a accesskey="u" href="apendice-otros-archivos.html">Subir</a></td><td width="40%" align="right"> <a accesskey="n" href="mover-controladores.html">Siguiente</a></td></tr><tr><td width="40%" align="left" valign="top">J.3. Instalación de mkntpwd </td><td width="20%" align="center"><a accesskey="h" href="index.html">Inicio</a></td><td width="40%" align="right" valign="top"> Apéndice L. Script para mover los controladores PostScript de Adobe al directorio
	/usr/share/cups/drivers</td></tr></table></div></body></html>
