1) Write a bash shellscript named decbin that converts binary to decimal and the
ID: 3617737 • Letter: 1
Question
1) Write a bash shellscript named decbin that converts binary to decimal and the other wayaround.
Do not worry aboutnumbers that go over 8 bits, i.e. 11111111 is your highest binarynumber and 255
is your highestdecimal number. The user command to execute the script shallbe:
./decbin destinationnumber,where: destination = bor h
Examples:
- decbin b6
110
- decbin b24
11000
- decbin d10101010
170
2) Copy the followingnames into a file named namelist in your directory, and note that it contains alist
of usernames. Then,write a bash script named addnames that is to be called by the followinguser
command, wherenamelist is the name of the namelist file, andusername is a particular student's
username.
./addnames namelistusername
The script should dothe following:
o check that the correct number of arguments wasreceived and print a usage help message if not,
o check whether the namelist file exists and printan error message if not,
o check whether the username is already in thefile, and then either print amessage stating that the name already existed, oradd the name to the end of thelist.
The namesare:
azahrani
oqahtani
msolami
araddadi