Saturday, September 23, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2647  / 8 Months ago, mon, january 30, 2023, 6:35:05

I wrote a bash script for my use and it works. I want that script to be put in some server in my network and call that script in laptops / desktops in my network itself to execute. Any way I have made a way for that also as below.


  1. Install Apache web server in local server.

  2. Put the script in web server.

  3. Make the script executable chmod a+x.

  4. Open terminal in the client machine and install the package curl

  5. Now from the client terminal itself execute the command as:

    sudo curl -kL http://serverip/ | bash

It works fine but only problem is, in my script I have used User input commands like "read variable", that doesn’t work in this scenario. So how to do that is my problem.
Is there any way for me ?

More From » bash


You can use:

bash -c "$(curl -kL http://serverip/"

This will run the script on the local machine. See also man bash to understand why I used -c option. Also double quotes are very important in this case.

Also, as @terdon said in his comment, sudo curl is pointless. If If the script needs local sudo permissions, you need to use sudo in front of bash command.

[#26272] Tuesday, January 31, 2023, 8 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 72
Total Questions: 121
Total Answers: 112

Location: North Korea
Member since Mon, Oct 31, 2022
12 Months ago