If you need to do quick calculations on a system that provides the
such as Linux or Mac OS X, you can perform calculations by
command and then using
to enclose the arithmetic calculation, i.e.,
echo $[calculation to be performed]
. You can use the
$ echo $[1+1]
$ echo $[9*90]
$ echo $[81/9]
$ echo $[2**3]
precedence for operators applies, i.e., multiplication
and division have precedence over addition and subtraction, so are performed
first, i.e., the calcuations are not simply done on a left to right basis.
$ echo $[2+3*4]
$ echo $[6-4/2]
This Bash calculator functionality even handles negative numbers
$ echo $[-4*5]
$ echo $[-4*-5]
When you need a quick & simple calculator in Bash...
TinyApps.Org, small is beautiful
Bash (Unix shell)
Wikipedia, the free encyclopedia
Retrieving Password Protected Webpages Using HTTPS With Curl
Mac OS X
systems come with the curl
line tool which provides the capability to retrieve web pages from a
prompt. To use the tool, using Finder on the system, you can go to
and double-click on Terminal
to obtain a shell prompt.
Curl is also available for a variety of other operating systems, including
DOS, Linux, and Windows. Versions for other operating systems can be obtained
from cURL - Download. If you
will be retrieving encrypted webpages using the HTTPs protocol, be sure
to get the binary version that includes
Layer (SSL) support.
A program with similar functionality is Wget, but that isn't
included by default with the current versions of the Mac OS X operating system.
On Mac OS X systems, curl is available in
/usr/bin and help on
the options for curl can be found using
curl --help, and
curl --manual. An
online manual can be viewed at
cURL - Manual.
To retrieve a webpage that requires a userid and password for access
with curl using the HTTPS
protocol, you can use a command similar to the one below where userid
and password represent the userid and password required to access
that particular webpage.
curl -u userid:password https://example.com/somepage.html
If you don't want to include the password on the command line, you can
just specify the userid after the
-u; curl will then prompt
you for the password.
$ curl -u jsmith https://example.com/somepage.html
Enter host password for user 'jsmith':
If you wish to save the output in a file rather than have it go to stdout, i.e.,
rather than have it appear on the screen, you can use the
-o/--output filename option where filename
is the name you wish to use for the output file. Curl will provide information
on the number of bytes downloaded and the time that it took to download a
$ curl -u jsmith:somepassword -o somepage.html https://example.com/somepage.html
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 22924 0 22924 0 0 16308 0 --:--:-- 0:00:01 --:--:-- 26379
cURL and libcurl