1

File prindi.sh contains

/usr/bin/lpr –P SL-M3325ND <teade.pdf

its inovoking returns error

/usr/bin/lpr: Error - unable to access "–P" - No such file or directory

If this command in invoked directly from command line it works:

# /usr/bin/lpr -P SL-M3325ND <teade.pdf
# lpq
SL-M3325ND is ready
no entries

How to fix this so that it can printed from prindi.sh also ?

2
  • 4
    The problem is the wrong kind of - sign in your script. Replace it with a good old-fashioned hyphen, and lpr will stop seeing –P as a (missing) file to be printed, and recognise -P as a flag (do you see they're different lengths?).
    – MadHatter
    May 6, 2016 at 15:48
  • I'm guessing from your response that that fixed it, so I've written it up as a full answer. Please either accept my answer or delete the question (up to you which!) so it doesn't float around forever. Thanks, and I'm glad you got things working.
    – MadHatter
    May 7, 2016 at 6:47

1 Answer 1

4

The problem is the wrong kind of - sign in your script (do you see they're different lengths?).

Replace it with a good old-fashioned hyphen, and lpr will stop seeing –P as a (missing) file to be printed, and recognise -P as a flag. And whoever wrote that script should stop using word processors to write shell scripts, and use a proper text editor instead (there's a difference!).

1
  • Oh yes, the joys (and pains) of Unicode... . You can have similar types of fun with the different types of quotes.
    – sleske
    May 12, 2016 at 7:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .