Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 489  / 1 Year ago, tue, january 24, 2023, 2:14:06

Lubuntu 20.04. I've created a simple .sh script to run my Java program, so content of .sh is:


java -jar /path_to_my/test.jar


I marked this script as executable, and when double-clicking on it in the file manager (PCManFM-Qt v. 0.14.1) it just opens a terminal (QTerminal) and does nothing.


When executing the script manually in the terminal it works.


More From » lubuntu

 Answers
7

The system has to know what type of script it is. That is done via the use of a "shebang"


For a simple bash script you can use


#!/bin/bash
echo blah
sleep 4

It worked for you in bash (terminal) as your bash terminal made an assumption you were trying to run a bash script. pcmanfm-qt cannot really make that assumption, so the shebang tells the system what type of script it is.


(You already had the executable flag correct that was also required)


[#1697] Wednesday, January 25, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ciousuntru

Total Points: 352
Total Questions: 124
Total Answers: 95

Location: Grenada
Member since Tue, Oct 12, 2021
3 Years ago
ciousuntru questions
;