Passing argument to a curl downloaded script

To add an argument to the execution of the script you’re downloading and running via curl, you can modify the command like this:

curl http://aaa.com/script.sh | sh -s -- scan
  • sh -s : This tells sh to accept input from stdin (which comes from curl via the pipe |).
  • : This marks the end of options for sh. Everything that follows will be considered arguments for the script.
  • scan : This is the argument you want to pass to the script

You can add other arguments by separating them with spaces after “scan” if needed.

This method allows you to execute the downloaded script with arguments, just as if you were running it directly on your system.

Leave a Comment

Your email address will not be published. Required fields are marked *