Script remove-selected-printers

El script remove-selected-printers obtiene una lista de las impresoras configuradas en el equipo y nos permite borrarlas:

#!/bin/bash
# ------------------------------------------------------------
# script:  /usr/local/sbin/remove-selected-printers
# Author:  Esteban M. Navas Martín
# Date:    06-09-2019
# Ver:     07-09-2019
#
# Purpose: Show configured printers and let delete it

# Copyright (c) 2019 Esteban M. Navas Martín . All rights reserved.
#
#   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 2 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 .

for printer in `LC_ALL=C.UTF-8 lpstat -p | awk '{print $2}'`; do
   dialog --title "Eliminar impresoras" --yesno "¿Desea borrar la impresora $printer?" 0 0
   if [ $? = 0 ]; then
      lpadmin -x $printer
      dialog --title "Eliminar impresoras" --msgbox "Impresora $printer eliminada" 0 0; clear
   fi
done

Si ejecutamos el script, obtendrá un listado de las impresoras configuradas en el equipo y nos irá preguntando si queremos borrar cada una de ellas:

Be the first to comment

Por favor acceder para comentar.