. Write a shell function called octal that converts octal numbers given as command-line arguments to decimal numbers and prints them out, one per line

$ octal 10 11 12
8
9
10
(Korn shell users, remember that if you assign a decimal number to a variable when it's declared – for example, typeset –i d=10#0 – assignments to this variable from other bases are automatically converted to decimal.)

This one's easier than it seems. Here's a simple solution:
#!/bin/sh

# octal - given octal values, display as decimal values

for octalnum
do
(( i = 8#$octalnum ))
echo $i
done

exit 0

Computer Science & Information Technology

You might also like to view...

Which of the following is not true about using filters in Access?

A) They provide quick answers. B) They can be saved as a query. C) They are normally not stored permanently. D) They are normally permanently stored.

Computer Science & Information Technology

Which of the following operating systems is found on Macintosh desktop and laptop computers?

A. iOS B. Linux C. Android D. macOS

Computer Science & Information Technology