Creating Printing Program in bash

Login or Register to Reply

Thread Tools Search this Thread
# 1  
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 01:18 PM..
# 2  
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  
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  
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  
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  
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  
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
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Help with creating a simple program!!
i am new to shell scripting!! i am making this program in bourne shell, that asks the user to input "Hello (their name)" or "question (their name)", any other input, "ERROR" will be outputted. if they input "Hello (name)", i want to out saying Hello (name) but if they input "question (name)", i...... UNIX for Dummies Questions & Answers
UNIX for Dummies Questions & Answers
help needed with creating challenging bash script with creating directories
Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So...... Shell Programming and Scripting
Shell Programming and Scripting
Dynamically Creating and Printing to Files
Hello, If anyone could help me out with this, it would be greatly appreciated. I am trying to dynamically create files and print to them. Here is the code I have to so far. thanks. if (n < 5000 ) { # do nothing } else { n = 0; filenum++; # out = ("out" filenum); } ...... Shell Programming and Scripting
Shell Programming and Scripting
Creating a line for printing
Hi All I need to create a report and need some help on the formating side. In this report, I gather information from 2 different files and produce the line. I was looking at having a variable for the full lenght of the line with spaces and using the substr to put the right fields in place. Is...... Shell Programming and Scripting
Shell Programming and Scripting
Creating instances of a program
Hi, Presently I have script #!/bin/ksh in which 4 executables are executed as 1,2,3 and 4.Executable 2 is an extract program which extracts records from a table.and executable 4 is a program that updates a database. Currenlty this process takes a hell lot of time and my aim is to reduce the...... Shell Programming and Scripting
Shell Programming and Scripting