Creating Printing Program in bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating Printing Program in bash
# 8  
Old 03-09-2012
correct but i want to save a bash file so i can use it again and again

---------- Post updated at 01:39 PM ---------- Previous update was at 01:34 PM ----------

This is the epl2 code for the demensions
N q609 A100,10,0,5,2,2,N," " P1
# 9  
Old 03-09-2012
You said in post #4 that you didnt want a file so you can use again and again...
# 10  
Old 03-09-2012
From their EPL2 examples, perhaps something like

Code:
for ((N=1; N<3; N++))
do
        CODE=`printf %08d $N`
        cat <<EOF
N
B1,5,0,3,3,7,40,B,"$CODE"
P1
EOF
done | sed 's/$/\r/' > /dev/usblp0

This User Gave Thanks to Corona688 For This Post:
# 11  
Old 03-09-2012
Quote:
Originally Posted by vbe
You said in post #4 that you didnt want a file so you can use again and again...
I think he means he wants a bash script which generates lots of similar labels, instead of a text file containing EPL2 commands which he edits by hand.

Quote:
Originally Posted by bganse
N q609 A100,10,0,5,2,2,N," " P1
That's only the text to clear the buffer. What code would you actually use to print a label? And how do you usually send these codes to the printer?
This User Gave Thanks to Corona688 For This Post:
# 12  
Old 03-09-2012
This is what i got so far you sent me on the right track but
IS it possible to put two lines in a variable


Code:
#!/bin/bash
newlabel="N"
labelwidth="q609"
labeltext='A100,10,0,5,2,2,N,"PC109":)\n TExt:)'
endlabel="P1"

echo $labeltext

---------- Post updated at 02:01 PM ---------- Previous update was at 01:59 PM ----------

sorry if i sound stupid im really new to bash

---------- Post updated at 02:02 PM ---------- Previous update was at 02:01 PM ----------

i started today

Last edited by Corona688; 03-09-2012 at 03:28 PM.. Reason: Code tags, please.
# 13  
Old 03-09-2012
In the future, please place source code and program output inside code tags when posting. It will prevent the problems you are having, like smilies appearing in the middle of your code.

[ code ] #!/bin/bash ... [ /code ] without the spaces in the tags and it will appear as
Code:
#!/bin/bash ...

It's even easier than you think to put two lines into a variable. Don't put in \n -- put in a real newline.

Code:
VARIABLE="line1
line2
line3"

Also, be sure to quote the variable when you use it, to prevent the shell from processing any of the whitespace.

Code:
echo $variable # This may convert newlines into spaces
echo "$variable" # this will not process the text inside, printing it raw


Last edited by Corona688; 03-09-2012 at 03:30 PM..
This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

New To Unix- Need Help With Bash Commands for Printing

Urgent Help - I have a problem, I need to know how to print a count of files from a specific date that passed and that failed. Additionally, print the name of the files located on the date, print a list of all dates during which a file with a name like 'test' was processed, and then determine... (5 Replies)
Discussion started by: AJ 49er
5 Replies

2. Shell Programming and Scripting

Problem in perl program in printing all the entries

Hi all, I have a perl program where it checks for the presence of a particular line and prints the record if that line is present. But in the output file, all the entries are not being printed even if the entry has that line. The line to be matched is *FIELD* AV. The program which I wrote is... (1 Reply)
Discussion started by: kaav06
1 Replies

3. Programming

Dynamically creating structure in C/C++ program

Hi, For one of the project which i am working on i need to write a cpp code such that it will create the structure dynamically instead of reading it from header file. For example we have a program which is reading a binary file according to the structure mentioned in header file. But we... (0 Replies)
Discussion started by: AmbikaValagonda
0 Replies

4. UNIX for Dummies Questions & Answers

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... (4 Replies)
Discussion started by: bshell_1214
4 Replies

5. Shell Programming and Scripting

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... (7 Replies)
Discussion started by: I-1
7 Replies

6. 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); } ... (1 Reply)
Discussion started by: Laud12345
1 Replies

7. Shell Programming and Scripting

Creating simple shell program

Hi, I'm new to UNIX shell programming... can anyone help in doing the following : 1) create a text file named "Model File" having following columns : Name Number Physics Chemistry 2) prompt user to n rows enter the name, number, physics ,chemistry 3) display the entire columns and rows... (1 Reply)
Discussion started by: Mayuri P R
1 Replies

8. Programming

problem in creating executable for a client program

Hi, I am trying to run simple client server c program in unix.At the compling stage server is creating an executable but the client is not. below is the link to the source codes: http://www.cs.rpi.edu/courses/sysprog/sockets/server.c http://www.cs.rpi.edu/courses/sysprog/sockets/client.c ... (2 Replies)
Discussion started by: konas
2 Replies

9. 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... (3 Replies)
Discussion started by: jhansrod
3 Replies

10. 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... (2 Replies)
Discussion started by: tushar_johri
2 Replies
Login or Register to Ask a Question