Thursday, May 2, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1014  / 3 Years ago, sun, november 14, 2021, 7:25:45

Let's say I have a downloadable text file on my website that says



sudo apt-getupdate


How can I make it so that the user downloads it and it auto puts that code into terminal? What would I do for something that has many lines of code?


More From » command-line

 Answers
5

If you put this line:



#!/bin/bash


at the beginning of the text file, Ubuntu will know than is an executable file to be interpreted by bash. So your file would look something like this:



#!/bin/bash
sudo apt-get update


When the user double clicks the file, she/he will be asked if wants the executable to be run in a terminal.


[#27703] Monday, November 15, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tionavocad

Total Points: 189
Total Questions: 101
Total Answers: 118

Location: Liechtenstein
Member since Wed, Dec 8, 2021
2 Years ago
;