Question

I have a bash file called 1.sh follows :

#!/bin/bash

lpr "this doc.pdf"

The properties are set to "allow executing file as a program".

when i open the terminal and type

lpr ./1.sh

it prints on the printer to paper.

when I double click on the file and choose either "Run" or "Run in terminal" it does not print. Anyone any ideas.

Thank you

Était-ce utile?

La solution

The working directory of the process when you start it by double-clicking is probably different than when you are logged in at the terminal, so there is no "this doc.pdf" in the current directory. Use an absolute path name in the script:

#!/bin/bash
lpr /path/to/"this doc.pdf"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top