Curl to exapnd short url

2022-01-09 1 min read Learning Bash

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

1
curl -I https://bit.ly/32WwCp4|grep location

and the output should be something like

Continue reading

Sleep infinitely in bash

2021-12-19 1 min read Learning Bash

I am sure that you would have got a lot of instances where you have wanted to sleep for infinity and ended up doing this

1
2
3
4
while [[ 1 ]]
do
	sleep 3600
done

or some other such similar loop to sleep for some time and wrap it in infinite loop.

I learned something new recently and found it very useful. You can do the above with

1
sleep infinity

and you can use that even for a while loop

Continue reading

Ignore case when completing file names in bash

2021-12-11 1 min read Learning Bash

Sometimes you don’t want to have the bash completion work with case completion. There could be several reasons like one I dont like is the default xdg folders starting with capital letters.

So, if you know that bash uses readline for a lot of configuration then there is a very easy solution, you can just run this command and start a new bash shell :)

1
echo 'set completion-ignore-case on' >> ~/.inputrc

Enjoy 👍

Continue reading
Older posts Newer posts