Execute 2 or more remote scripts sharing the same curl pattern, without redundancy

user9303970

I use Ubuntu 16.04 and I execute a list of remote scripts that are in the same directory (a GitHub repository):

curl -s https://raw.githubusercontent.com/${user}/${repo}/master/1.sh | tr -d '\r' | bash
curl -s https://raw.githubusercontent.com/${user}/${repo}/master/2.sh | tr -d '\r' | bash
curl -s https://raw.githubusercontent.com/${user}/${repo}/master/3.sh | tr -d '\r' | bash
curl -s https://raw.githubusercontent.com/${user}/${repo}/master/4.sh | tr -d '\r' | bash
curl -s https://raw.githubusercontent.com/${user}/${repo}/master/5.sh | tr -d '\r' | bash
curl -s https://raw.githubusercontent.com/${user}/${repo}/master/6.sh | tr -d '\r' | bash

How would you cope with the awful redundancy?

I think of a for loop but I have no idea how to construct it. All for loops I've seen so far doesn't give me a clue on how to do that particular task of reusing a curl pattern (and piped output) for different files in the same remote directory.

You are more than welcome to share an example.

Update

  • There might be more or less than six such curl operations.
  • I would use any plausible way but if it requires a utility please recommend a utility available in the Debian repositories.
Raman Sailopal

For two or more files you could use Unix seq:

for var in $(seq 6)
   do 
       curl -s https://raw.githubusercontent.com/${user}/${repo}/master/$var.sh | tr -d '\r' | bash
   done

Explanation:

  1. Use the output of seq to attain a count up to 6 (as the question lists 6 curl operations).
  2. Read the output into the variable var and use this in your curl command.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Execute commands on a remote servers by 2 scripts

From Dev

Social media sharing without scripts

From Dev

execute script on remote using curl

From Dev

Observable pattern redundancy in Ruby

From Dev

Observable pattern redundancy in Ruby

From Dev

GreaseMonkey - sharing data between two scripts running in same tab

From Dev

2 local repositories sharing a remote repository

From Dev

Can't execute init scripts on remote host via ssh

From Dev

Errant error output behavior with perl execute bash scripts on a remote machine

From Dev

Can't execute init scripts on remote host via ssh

From Dev

Sharing RAM resources between 2 or more computers

From Dev

Avoiding redundancy in Composition pattern java

From Dev

Avoiding redundancy in Composition pattern java

From Java

Execute a PHP script file on a remote server without copying it on the remote server

From Dev

SSH remote command execute stays without disconnect when finished execute?

From Dev

Execute scripts returned from .each() synchronously, but without delay in order of completion

From Dev

How to execute the same curl request on a sequence of server IPs (URLs)

From Dev

Regex for excluding a pattern of more than 2 "==" in Java

From Dev

PHP running 2 scripts at the same time

From Dev

How to remote execute ssh command a sudo command without password

From Dev

Execute (Specific) command on remote host without using SSH

From Dev

Java Android: Execute more blocks of code at the same time

From Dev

Passing 2 pointers to 2 threads but they end up sharing the same

From Dev

Passing 2 pointers to 2 threads but they end up sharing the same

From Dev

How to execute EMR step that loads more scripts from s3?

From Dev

More Explanation on File Sharing

From Dev

Same Remote Validation for 2 different properties in a model

From Dev

Sharing variables between shell scripts

From Dev

Sharing raw input with multiple scripts

Related Related

  1. 1

    Execute commands on a remote servers by 2 scripts

  2. 2

    Social media sharing without scripts

  3. 3

    execute script on remote using curl

  4. 4

    Observable pattern redundancy in Ruby

  5. 5

    Observable pattern redundancy in Ruby

  6. 6

    GreaseMonkey - sharing data between two scripts running in same tab

  7. 7

    2 local repositories sharing a remote repository

  8. 8

    Can't execute init scripts on remote host via ssh

  9. 9

    Errant error output behavior with perl execute bash scripts on a remote machine

  10. 10

    Can't execute init scripts on remote host via ssh

  11. 11

    Sharing RAM resources between 2 or more computers

  12. 12

    Avoiding redundancy in Composition pattern java

  13. 13

    Avoiding redundancy in Composition pattern java

  14. 14

    Execute a PHP script file on a remote server without copying it on the remote server

  15. 15

    SSH remote command execute stays without disconnect when finished execute?

  16. 16

    Execute scripts returned from .each() synchronously, but without delay in order of completion

  17. 17

    How to execute the same curl request on a sequence of server IPs (URLs)

  18. 18

    Regex for excluding a pattern of more than 2 "==" in Java

  19. 19

    PHP running 2 scripts at the same time

  20. 20

    How to remote execute ssh command a sudo command without password

  21. 21

    Execute (Specific) command on remote host without using SSH

  22. 22

    Java Android: Execute more blocks of code at the same time

  23. 23

    Passing 2 pointers to 2 threads but they end up sharing the same

  24. 24

    Passing 2 pointers to 2 threads but they end up sharing the same

  25. 25

    How to execute EMR step that loads more scripts from s3?

  26. 26

    More Explanation on File Sharing

  27. 27

    Same Remote Validation for 2 different properties in a model

  28. 28

    Sharing variables between shell scripts

  29. 29

    Sharing raw input with multiple scripts

HotTag

Archive