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"