Ubuntu 16.04でシェルスクリプトをダブルクリックすると、Nautilusはユーザーにシェルスクリプトファイルを編集するためのオプションのみを提供します。

Ubuntu 16.04でシェルスクリプトをダブルクリックすると、Nautilusはユーザーにシェルスクリプトファイルを編集するためのオプションのみを提供します。
When I follow the steps in 

[https://askubuntu.com/questions/138908/how-to-execute-a-script-just-by-double-clicking-like-exe-files-in-windows]

シェルスクリプトを実行するか、geditを使用して編集するかを尋ねるダイアログボックスを受け取ったことがあります。 LiveCDを使ってUbuntu Linux 16.04を再インストールし、sudo apt-get install mono-completeを実行しました。 Ubuntu 16.04 Nautilusでシェルスクリプトをダブルクリックすると、シェルスクリプトファイルのみを編集できます。

The contents of this shell script are:

#!/bin/bash
exec /usr/bin/mono-service.exe ./AudioRecorder.exe  "$@".

as specified in 

  [http://www.mono-project.com/archived/guiderunning_mono_applications/]

この問題はなぜ発生し、どのように解決できますか? Nautilusでシェルスクリプトをダブルクリックすると、シェルスクリプトファイルを実行するように求められます。

どんな助けでも大変感謝します。

ベストアンサー1

まず、/usr/bin/mono-service.exe存在しません。

次に、投稿したリンク。スクリプトは次のようにする必要があります。

#!/bin/sh
/usr/bin/mono /usr/lib/mono/4.5/mono-service.exe ./AudioRecorder.exe  "$@"

または

#!/bin/sh
/usr/bin/mono-service ./AudioRecorder.exe  "$@"

または

#!/bin/bash
mono ./AudioRecorder.exe  "$@"

または

#!/bin/sh
/usr/bin/mono ./AudioRecorder.exe  "$@"

ただし、これはexeファイルがホームフォルダにある場合にのみ機能し、理想的にはexeファイルがホームフォルダにある場合は、次のようにexeファイルの実際のパスを含める必要があります。

#!/bin/sh
/usr/bin/mono /usr/lib/mono/4.5/mono-service.exe ~/AudioRecorder.exe  "$@"

または

#!/bin/sh
/usr/bin/mono-service ~/AudioRecorder.exe  "$@"

または

#!/bin/bash
mono ~/AudioRecorder.exe  "$@"

または

#!/bin/sh
/usr/bin/mono ~/AudioRecorder.exe  "$@"

またはファイルがダウンロードフォルダにある場合:

#!/bin/sh
/usr/bin/mono /usr/lib/mono/4.5/mono-service.exe ~/Downloads/AudioRecorder.exe  "$@"

または

#!/bin/sh
/usr/bin/mono-service ~/Downloads/AudioRecorder.exe  "$@"

または

#!/bin/bash
mono ~/Downloads/AudioRecorder.exe  "$@"

または

#!/bin/sh
/usr/bin/mono ~/Downloads/AudioRecorder.exe  "$@"

おすすめ記事