Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为 1.sh 的 bash 文件如下:
#!/bin/bash lpr "this doc.pdf"
属性设置为“允许将文件作为程序执行”。
当我打开终端并输入
lpr ./1.sh
它在打印机上打印到纸上。
当我双击文件并选择“运行”或“在终端中运行”时,它不会打印。任何人任何想法。
谢谢
进程双击启动时的工作目录可能与终端登录时不同,所以当前目录下没有“this doc.pdf”。在脚本中使用绝对路径名:
#!/bin/bash lpr /path/to/"this doc.pdf"