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 ?

Andrus
  • 169
  • 4
  • 11
  • 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 06 '16 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 07 '16 at 06:47

1 Answers1

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!).

MadHatter
  • 78,442
  • 20
  • 178
  • 229
  • Oh yes, the joys (and pains) of Unicode... . You can have similar types of fun with the different types of quotes. – sleske May 12 '16 at 07:02