Created
September 30, 2015 20:05
-
-
Save merovingian/67cbd782c8c64267084a to your computer and use it in GitHub Desktop.
Clear Linux print queue Bash script, invoke the script with your printer on the commandline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This script can be used to easily clear a print queue | |
# Specify your printer as the first argument | |
E_NO_ARGS=65 | |
if [ $# -eq 0 ] # You must specify a printer as argument. | |
then | |
echo "Please invoke this script with one or more command-line arguments." | |
exit $E_NO_ARGS | |
fi | |
for i in $(lpstat -P $1 | sed 's/'$1-'//' | awk ' { print $1} ') | |
do lprm -P $1 $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment