How to resolve the algorithm Hello world/Line printer step by step in the UNIX Shell programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Hello world/Line printer step by step in the UNIX Shell programming language
Table of Contents
Problem Statement
Cause a line printer attached to the computer to print a line containing the message: Hello World!
A line printer is not the same as standard output. A line printer was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be any device attached to an appropriate port (such as a parallel port).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Hello world/Line printer step by step in the UNIX Shell programming language
Source code in the unix programming language
# Use the default printer queue, with lp(1) or lpr(1).
# 1. The system must have a printer queue.
# 2. The printer queue must understand plain text.
# 3. System V has lp(1). BSD has lpr(1).
# CUPS has both lp(1) and lpr(1).
#
echo 'Hello World!' | lp
echo 'Hello World!' | lpr
# Use a character device.
# 1. The device must understand plain text.
# 2. You must have write permission for the device.
# 3. Some systems have /dev/lp0, /dev/lp1, ...
# 4. BSD has /dev/lpt0, /dev/lpt1, ... for the parallel ports;
# and /dev/ulpt0, /dev/ulpt1, ... for the USB printers.
# Note that intermingling can occur if two processes write to the device at the
# same time. Using the print spooler method above avoids this problem,
#
echo 'Hello World!' >/dev/lp0
echo 'Hello World!' >/dev/lpt0
echo 'Hello World!' >/dev/ulpt0
You may also check:How to resolve the algorithm Prime conspiracy step by step in the Fortran programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Oberon-2 programming language
You may also check:How to resolve the algorithm JSON step by step in the Swift programming language
You may also check:How to resolve the algorithm Roots of unity step by step in the Ada programming language
You may also check:How to resolve the algorithm Plasma effect step by step in the Ol programming language