Domanda

I've seen this done and I used to be able to do it. I had it documented in a file that was clobbered recently in a backup issue.

I have a text string I want to print from bash using lpr. I know I can print text files easily, but how can I print text that is just in quotation marks or in a string without first saving it as a file, then printing the file?

È stato utile?

Soluzione

You could use here-strings with

lpr <<< "text string"

or if your string is contained in a variable

lpr <<< "$var"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top