문제

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?

도움이 되었습니까?

해결책

You could use here-strings with

lpr <<< "text string"

or if your string is contained in a variable

lpr <<< "$var"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top