enable duplex printing

Our Student Users don’t have admin rights. So it was necessary to adapt the [UsedPrinterName].ppd file. And set the Value from  DefaultAPOptionalDuplexer: False to True.

magic:

sed -i '' 's/*search_string/*replace_string/g' /path/to/file.extension

-i ”” edit the changes into the same file (there is a blank between -i  and the double empty quote!

############ change duplex 
Printer_X=$(less /private/etc/cups/ppd/Printer_X.ppd | grep "*DefaultAPOptionalDuplexer: False")

    if [ "$Printer_X" == "*DefaultAPOptionalDuplexer: False" ] 
    then
        echo "change Printer_X to duplex"
       	sed -i '' 's/*DefaultAPOptionalDuplexer: False/*DefaultAPOptionalDuplexer: True/g' /private/etc/cups/ppd/Printer_X.ppd
    else
    	echo "not needed"
    fi
############ 


Posted

in