Operating System - HP-UX
1836731 Members
2963 Online
110109 Solutions
New Discussion

Re: aliasing LP commands in the .profile

 
SOLVED
Go to solution
rmueller58
Valued Contributor

aliasing LP commands in the .profile

All

I am trying to dummy proof printing for a group of my users.. We have an app on our UX box that make it possible for them to use a default printer.. Simple enough, I at the
export LPDEST= in the .profile..

Now I need to alias or have some way for them to print compressed and vsi7.27


my normal lp command for the printer would be
lp -d -oc -ovsi7.27

I've tried defining the lp as an alias to itself by doing an alias in the .profile and all in a script that would be ran from the .profile.

alias lp='lp -ovsi7.27 -oc'

I thought would work, tried is several ways.. Could someone point in a direction?? Thanks in advance..

Rex M

24 REPLIES 24
Marlou Everson
Trusted Contributor
Solution

Re: aliasing LP commands in the .profile

Rex,

Another option is to create another print queue just to do the compressed print. If this is a LaserJet, create the print queue and then you can modify the script in /etc/lp/interface/model.orig. Edit the options line:

from options="$5"
to options=$5" vsi7.27 c"

I've got dozens of print queues set up this way. It works well.

Marlou
Biswajit Tripathy
Honored Contributor

Re: aliasing LP commands in the .profile

That should work.
Try changing the alias to
alias lp='/usr/bin/lp -ovsi7.27 -oc'

- Biswajit
:-)
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Bis,

I didn't think of placing the full path to the executable.. I will try it..

Thanks ..

Rex
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Tried both marlou's and bis's in the .profile to no avail..

here is the .profile I am using as a template.


# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^?" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# Set up the search paths:
PATH=$PATH:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0
trap "" 1 2 3
# Set up the shell variables:
EDITOR=vi
export EDITOR

export FGLGUI=1

# Define Default Printer
export LPDEST=elkadm8150

# "setcompprint calls an alias for LP"
# alias lp='/usr/bin/lp -ovsi7.27 -oc'
. setcompprint

## Application
. menufpsadm
RAC_1
Honored Contributor

Re: aliasing LP commands in the .profile

alias lp='lp -delkadm8150 -ovsi7.27 -oc'

Anil
There is no substitute to HARDWORK
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

RAC

then remove the LPDEST VARIABLE Correct?
Marlou Everson
Trusted Contributor

Re: aliasing LP commands in the .profile

Rex,

Is your . menu... at the end going to a subshell? You may need alias -x.

Marlou
RAC_1
Honored Contributor

Re: aliasing LP commands in the .profile

No need to do that, What that variable does, is if you do not specify printer name -d option on lp command, it takes that as default.

The way, would be defining default printer with lpadmin -d "xxss"
and setting an alias as follows.

lp='/usr/bin/lp -ovsi7.27 -oc' - tis should work after defining default printer.

Anil
There is no substitute to HARDWORK
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Tried alias -x lp='lp .............'
Tried alias lp='lp -d ............'

nothing seems to be clicking and my brain isn't functioning too well, it must be friday. Maybe it will come to me when I am out metal detecting this weekend..


Marlou Everson
Trusted Contributor

Re: aliasing LP commands in the .profile

Perhaps you need to explain what exactly is not working. For a LaserJet, there is a banner page that lists the options. My tests show Options:vsi7.27 c on the banner page.

You can also look in /var/adm/lp/log for more information.

Marlou
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

marlou,

Changing the model script is not an option because they may have 4 other orientations that need to be ran through the device..

Stuart Browne
Honored Contributor

Re: aliasing LP commands in the .profile

You're trying to use an 'app' of which is running on the Unix box to do this aren't you?

I assume the app is a compiled binary and thus is probably using a 'system()' or 'exec()' type call to call the LP binary directly, of which wouldn't be affected by any shell aliases.

This leaves you with making the printer interface more intelligent to automatically set the options based on the input file.

Well, that's my take on what you've said so far.
One long-haired git at your service...
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Stuart,

The App is a "4gl" program that has defined printers in the database. However in lieu of printing through the select a printer they use can print to "default" printer. It still requires a "unix" que defined as LPDEST variable.

Can one define "LPDEST" with the command line switches?

ie:
export LPDEST=quename -ovsi7.27 -oc

??
RAC_1
Honored Contributor

Re: aliasing LP commands in the .profile

LPDEST can not have any args. It should just be "printer_queue" name.

Now, does your app, use lp?? You sure about it??
type lp. What does it return??

Anil
There is no substitute to HARDWORK
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Yes it uses lp..

the app makes calls to the lp subsystem, (or other wise defines output devices), It also CAN parse through PDF, EZ Spool, Optio and other various types of output.

Pete Randall
Outstanding Contributor

Re: aliasing LP commands in the .profile

Rex,

What does "whence -v lp" report?


Pete

Pete
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

# whence -v lp
lp is /usr/bin/lp
Pete Randall
Outstanding Contributor

Re: aliasing LP commands in the .profile

That doesn't sound like your alias is set. It should report something like:
"lp is an alias for lp -ovsi7.27 -oc"


Pete

Pete
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Pete,

I can define the alias from the Command line, but when I put it in the .profile, it fails.

Pete Randall
Outstanding Contributor

Re: aliasing LP commands in the .profile

Rex,

Have you tried putting it in the rc file for whichever shell you're using?


Pete

Pete
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

haven't tried the rc file yet.. I do have a couple other things I need to test.. Will try it..


Pete Randall
Outstanding Contributor

Re: aliasing LP commands in the .profile

Rex,

We use korn shell so we set aliases in the .kshrc file.

$ more .kshrc
alias bdf="/usr/local/bin/bdfmegs"
alias lp="lp -o nb"

$ whence -v lp
lp is an alias for lp -o nb

That seems to work for us.


Pete

Pete
rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

Thanks for the heads on the kshrc. Dummy proofing several accoutns now.. Thanks all for the assist.

rmueller58
Valued Contributor

Re: aliasing LP commands in the .profile

pete's da Man!!

Thanks..