Using variables in command line

So as not to retype a parameter which shall appear in several places in your command at the command line, you can first define it as a variable and then reuse it as many times as you want. Like this (for the bash shell anyway):

myvariable=something
echo $myvariable; echo This is $myvariable !

P.S.
Please note that there are no spaces to the either side of the equals sign.

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s