Curl to exapnd short url
Many times I receive short urls in mail and other places like chats and messages. I first like to see the destination before I click on the url. I was looking for some way to do this in bash. I realized that this could be very simply done by looking at the Location header in the response from curl.
Example
|
|
and the output should be something like
|
|
and if you would like to simplify this, then you can use the following
|
|
and this will print only the final url.
Related Articles:
- 2021/12/19 Sleep infinitely in bash
- 2021/12/11 Ignore case when completing file names in bash
- 2020/08/30 Warn when battery is low
- 2020/08/23 Some good find alias.
- 2020/08/16 Books menu with bash
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.