Creating Printing Program in bash

bash, label printing, printing, script, shell scripts

Thread Tools Search this Thread
# 1  
Old 03-09-2012
Creating Printing Program in bash


I am trying to create a bash script to print whatever i type in

It has to have these below to define the size of the label and what size to print the text
A100,10,0,5,2,2,N," "

It has to be sent to below
> /dev/usblp0

So what it has to be is

Written Text ----> sent to printer

and i want to be able to write what i want to print

PLEASE HELP!!!!!!!Smilie

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 03-09-2012 at 02:18 PM..
# 2  
Old 03-09-2012
Any printer which understands postscript or PCL can also understand raw text so perhaps, at its very simplest, you could do:

sed 's/$/\r/n' >/dev/usblp0

When run in a terminal, sed will read from the keyboard, convert \n into \r\n, and print it back out into /dev/usblp0.

When you're finished typing, hit control-D to tell sed the document is finished and to quit. You may not see any printing happen until you do, unless you have an old-fashioned tractor feed printer. Even for those, you won't see any printing until you finish a line with enter...
# 3  
Old 03-09-2012
What I dont get is what do you mean by written text sent to printer...
The rest:
You put the desired sequence in a file, you send it to the printer ... then ? see above...
I would use an alias for setting the printer, like that you could have a few settings you would call before to print...
# 4  
Old 03-09-2012
i dont want to save a file and then use that code every time i just want to be able to type then print because i have like a thousand codes to print
# 5  
Old 03-09-2012
Why not type the thousands of things into one big file, then? Smilie Then just print the big file.

I suspect if you explained exactly what you're doing better, we could find better ways to do it.
# 6  
Old 03-09-2012
Sorry im not that good at explaning my self
I have a lp 2844 label printer and i have to print stickers out with a code on each of them for items that are going to be stored so i can keep track of them in an excel file
# 7  
Old 03-09-2012
You want to generate numbered stickers?

How do you usually use this printer? It may be proprietary app-specific, and may be easier to use it than try and write a whole printing system from scratch.

This printer apparently speaks EPL2

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Creating .../ alias in bash kristinu Shell Programming and Scripting 3 01-20-2013 09:19 AM
New To Unix- Need Help With Bash Commands for Printing AJ 49er UNIX for Advanced & Expert Users 5 10-08-2012 12:27 AM
Problem in perl program in printing all the entries kaav06 Shell Programming and Scripting 1 06-06-2012 09:59 AM
Creating variables in bash kristinu Shell Programming and Scripting 10 04-20-2012 07:45 AM
Dynamically creating structure in C/C++ program AmbikaValagonda Programming 0 03-21-2012 06:21 AM
BASH - Creating a Matrix vinzping UNIX for Dummies Questions & Answers 0 11-06-2011 10:18 AM
Help with creating a simple program!! bshell_1214 UNIX for Dummies Questions & Answers 4 09-22-2011 12:59 PM
Printing special character in bash sentinel Shell Programming and Scripting 6 01-04-2010 05:25 AM
help needed with creating challenging bash script with creating directories I-1 Shell Programming and Scripting 7 04-29-2009 06:33 AM
Dynamically Creating and Printing to Files Laud12345 Shell Programming and Scripting 1 03-18-2009 11:45 PM
Creating simple shell program Mayuri P R Shell Programming and Scripting 1 01-27-2009 07:49 AM
arrays not printing properly in bash npatwardhan Shell Programming and Scripting 1 11-14-2008 08:30 PM
problem in creating executable for a client program konas Programming 2 11-17-2006 02:09 PM
Creating a line for printing jhansrod Shell Programming and Scripting 3 06-17-2005 06:38 AM
Creating instances of a program tushar_johri Shell Programming and Scripting 2 05-25-2005 11:36 AM