Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am writing a shell script that takes in a time (in minutes) and opens an online egg timer set for that amount.

#Opens where TIME = number of minutes

When I run the above script it opens the web page I would like to set the time from the terminal. For example:

eggtimer 10

Would open

Thank you!

share|improve this question
The first command line argument is $1 so TIME=$1 or just put $1 in your URL. –  Joseph R. May 2 '14 at 0:07
@JosephR. Even if it seems too simple to you: Make that an answer so that it can be accepted and the question get marked done. –  Hauke Laging May 2 '14 at 0:18
@HaukeLaging Seems slm already took care of that :) –  Joseph R. May 2 '14 at 0:20
I swear I didn't even see your comment, I was already thinking of my ${VAR:-defaultval} post when I wrote it, just saw the commentary now. –  slm May 2 '14 at 0:22
@slm No worries. My previous comment was sincere, not passive aggressive :) –  Joseph R. May 2 '14 at 0:29

1 Answer 1

up vote 5 down vote accepted

If you use the following feature of Bash variables where they're used if they have a value otherwise a default value is used instead you can code up your example like so:

$ more etimer.bash 
#Opens where TIME = number of minutes

This will use an argument that's passed into etimer.bash if one is provided, otherwise will use 5 minutes.


$ ./etimer.bash

Results in this URL:

$ ./etimer.bash 10

Results in this URL:


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.