0

I'm trying to create a new command by downloading a gist from Github. I need to add an +x permission to the downloaded file. I can do it like this.

sudo curl -s $URL -o /usr/bin/hello && sudo chmod +x /usr/bin/hello

Although I want to grab -o value and add an +x permission to it. I imagine it as something like:

sudo curl -s $URL -o /usr/bin/hello | ¯\_(ツ)_/¯  chmod +x this_after_o_value

Is there a way I can achieve it? Awk, sed, tr, cut? I'm looking for a fairly simple solution.

1
  • It is not possible like you imagine, as curl doesn't report where it saved the file (not even with -v)
    – Panki
    Aug 27, 2020 at 11:02

1 Answer 1

2

You could use a variable for this task.

output="/usr/bin/hello"
sudo curl -s $URL -o $output && sudo chmod +x $output
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .