What happens if a non-integer value is typed? What if the argument is omitted?

Write a program called twice that takes a single integer argument and doubles its value:
$ twice 15
30
$ twice 0
0
$

It's a very simple script:
echo $(( $1 + $1 ))
Non-integer values are treated as the value zero, so the output is 0. If the argument is omitted, however, then it's a syntax error of $(( + )) with the error:
syntax error: operand expected (error token is " ")

Computer Science & Information Technology

You might also like to view...

Which statement pertaining to system reliability is FALSE?

A) Having the latest version of software products can make your system more reliable. B) You can clean out unnecessary programs from your Startup folder. C) An accumulation of temporary Internet files has no effect on your computer's overall performance. D) When you defrag your hard drive, it works more efficiently.

Computer Science & Information Technology

A field that is being removed from the PivotTable report is indicated by a(n) ________

A) delete button B) gray area C) no symbol D) X

Computer Science & Information Technology