IMG_7072
.png
keyboard_arrow_up
School
Macomb Community College *
*We aren’t endorsed by this school
Course
1710
Subject
Computer Science
Date
Jul 2, 2024
Type
png
Pages
1
Uploaded by AgentTeamGiraffe39
162 Chapter 8: Specifying Instructions to the Shell 0 10 MINUTES Lab Exercise 8.06: Gathering Error Numbers With redirection error, LaTrina can now implement all of the error checks, and check her own log file for messages. This will allow her to customize the program to trap every error the user generates. In time, her regist.exe will be crash-proof. She asks you how she can get the error codes for common UNIX errors. She knows what errors she is getting, but without the error codes she cannot program for the errors. You tell her about the $? variable, which holds the error code for the previous error. Learning Objectives In this lab, you will record error numbers for common commands. By the end of this lab, you'll be able to: e Determine the error code for any UNIX error Lab Materials and Setup The materials you need for this lab are: e Computer with Red Hat Linux 7.3 installed ® Pencil and paper Getting Down to Business The following table has several commands. Run the command and get the error number using the $? variable. Record the error number in the space provided. Recall that you will need to echo this variable to get the contents. You will have to apply the knowledge that you acquired in the Introduction to UNIX and Linux textbook by John Muster (McGraw-Hill/Osborne, 2002) for echoing variable contents. ¥ Warning Do not log in as root to run this exercise!
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
I need to create a Transposition Cipher in Java that runs in Eclipse. The programs need to ask the user to encrypt or decrypt, read/accept a user's text file(.TXT) (NOT PLAIN TEXT), and save it as a new text file (.TXT). Please include as many comments as possible that help explains each line of code.
arrow_forward
Write a Java program that allows the user to specify a file name on the command line and prints the number of characters, words, lines, average number of words per line, and average number of characters per word in that file. If the user does not specify any file name, then prompt the user for the name.
arrow_forward
could you please code this on notepade.
arrow_forward
Write a Java program that reads from a URL and searches for a given word in the URL and creates a statistic file as an output. The statistic file needs to include some information from the URL.
URL address
Number of words in the URL page
Number of repetitions for a given word
displays the number of times the word appears. You need to have two functions, one for reading from the URL and the other function for searching the word.
arrow_forward
Simple Encryption. Write a java program that reads from a file specified by the user and encrypt the content of the file using a simple shifting technique. Also, ask the user to input the shift size. Output the encrypted message to another file whose filename is also provided by the user.
For example,
Shift size: 1
Message read from the file: Hello Encrypted message: Ifmmp
arrow_forward
Answer the given question with a proper explanation and step-by-step solution.
Hello, I am trying to make a program that prints the contents of a file but whenever I try to run it, it just prints a bunch of question marks infinitely and this only happens when I run it on a UTM virtual machine(Linux terminal). It works fine when I run it on my Mac terminal so I am not sure if it has to do with the virtual machine or my program. Please help!!
Image 1: cat.c
Image 2: input.txt
Image 3: output/results
arrow_forward
Write a program in HACK assembly, without using symbols, that implements the
described Feistel encryption system. The initial key, Ko, will be stored in RAM[1],
and the 16-bit plaintext will be stored in RAM[2]. The result of the encryption
should be stored in RAM[0]. Your solution should be submitted in a file called
"FeistelEncryption.asm".
arrow_forward
Implement a simple version of the linux cat command in C++. Use the system calls open(), get() and close().
cat - reads a file as specified by the user and prints its contents. A typical usage is as follows:
If from my terminal y run ./cat main.cpp
the contents of main.cpp. will be printed.
Your program cat can be invoked with one or more files on the command line; it should just print out each file in turn. Example:
[terminal]$ ./cat main.cpp main2.cpp #include <iostream>using namespace std;int main(){cout << "Hello, World!"; return 0;}#include <iostream>using namespace std;int main(){cout << "Programming is great fun!";return 0;}
As you can see content of main.cpp was printed first and the content of main2.cpp
arrow_forward
Create a python module called
MyEncryption to implement the
Cesar cipher encryption. The module
should contain two functions as
follow; encrypt ( plainfilename, key)
and decrypt ( cipherfilename, key).
The encrypt function reads plaintext
from a given filename, performs text
encryption using the given key, and
then writes the encrypted ciphertext
in an output text file. The decrypt
function reads ciphertext from a given
filename, performs text decryption
using the given key, and then writes
the plaintext in an output text file.
Create a text file with some text.
Import the MyEncryption module in
your main module and test both the
encryption and decryption functions.
arrow_forward
In Java
arrow_forward
Write a test client which takes a file path as an argument and reads each line one by one. The file can contain any number of DNA sequences (i.e., Strings.). After reading each DNA sequence, your code should print the DNA sequence first. Please follow the screenshot below for the output format.
If the DNA sequence is valid DNA, report that and print out its complement as well as whether or not it is a Watson-Crick complemented palindrome. If the DNA sequence is not a valid DNA, only report that.
Continue this process for each DNA sequence in the text file. Separate the outputs for each sequence by printing a line as shown in the screenshot.
In your project directory, create a new directory named ‘in’. The in folder will contain the input text file, titled sequences.txt. To run the code, your program argument should be in/sequences.txt
Method Summary.
Return Type
Method
1
boolean
isValid(String DNA)
2
String…
arrow_forward
Implement a simple version of the linux grep command in C++. grep - Looks through a file, line by line, trying to find a user-specified search term in the line. If a line has the word within it, the line is printed out, otherwise it is not. Use the system calls open(), getline(), close().
Requirements (examples run from. terminal)
Your program grep is always passed a search term and zero or more files to grep through (thus, more than one is possible). It should go through each line and see if the search term is in it; if so, the line should be printed, and if not, the line should be skipped.
[terminal]$ ./grep ! main.cpp main2.cppcout << "Hello, World!";cout << "Programming is great fun!";
The matching is case sensitive. Thus, if searching for world, lines with World will not match.
Lines can be arbitrarily long (that is, you may see many many characters before you encounter a newline character, \n). grep should work as expected even with very long lines. For this,…
arrow_forward
In UNIX, how would you remove the directory test and all files and subdirectories
(recursively) in it? The directory test is located in (is a subdirectory of)
/home/myid/smith/projects.
O rmdir /home/myid/smith/projects/test
O rmdir -r /home/myid/smith/projects/test
rm -r /home/myid/smith/projects/test
O rm -r projects/test
arrow_forward
Implement a system of three concurrent processes which read and write sequence numbers to a file. Each of the three processes must obtain 200 integers from the file. The file only holds one integer at a given time. Given a file, F, containing a single integer, each process must perform the following steps:
Please show steps and answer.
arrow_forward
implementation of Caesar Cipher:You are required to implement the Caesar Cipher encryption/decryption algorithm in Python. Remember to implement the algorithm in such a way that it takes a file as input, encrypts it and store in the current directory. This encrypted file must checkable. The implementation must have a decryption procedure which takes the encrypted file from the current directory, decrypts it and store it with some specific name in the current directory. The name should be different from the original file so that it can be verified.
arrow_forward
Write an application in java that encrypts and decrypts on Counter mode using:
Aphine chiper modulo 256, Hills chiper modulo 256 and S-DES (Simplifies DES).
Testing data for S-DES using Counter mode start from: 0000 0000, with text in binary form: 0000 0001 0000 0010 0000 0100 and key: 01111 11101 which will give the result: 0011 1000 0100 1111 0011 0010. Decryption should work.
arrow_forward
Using SIMPLE java, I need some help with file encryption. Looking for a way to include the ability to decrypt encrypted messages. The decryption program should read the contents of "Encrypted.txt", restore the data to its original state, and write it to a file named "Decrypted.txt". Also demonstrate appropriate exception handling for file I/O. Thanks!
Here is code I have and I need help with the decryptFile method.
public class Crypto{/**The decryptFile method decrypts an encrypted file.@param existing The name of the existing file to decrypt.@param decrypted The name of the decrypted file to create.@exception IOException When an IO error occurs.*/private static final byte KEY = 10;public static void decryptFile(String existing, String encrypted){}
public class FileDecryptionFilter{public static void main(String[] args){System.out.println("Decrypting the contents of the file");System.out.println("Encrypted.txt. The encrypted file will");System.out.println("be stored as…
arrow_forward
In Python please. Need help deleting byte information from a text file. It involves TCP programming. The user enters information of a student (ID, first, and last name). The user has the option to delete a student's information by looking up the ID and removing it from the text file.
arrow_forward
Unix-based operating systems usually include a tool named tail. It displays the last 10 lines of a file whose name is provided as a command line argument. Write a Java program that provides the same behavior i.e. the user can specify how many lines to print from the terminal. Display an appropriate error message if the file requested by the user does not exist, or if the command line argument is omitted.
Note: Make sure to display the last n lines of a file whose name is provided as a command line argument. You might need to pass a file as an argument, therefore make sure to have access to a sample file, the contents of which you want to print out.
arrow_forward
I need a help with my python activity. This requires 2 clients and 1 server. This is a system to support an online math contest.
Rule:
There are two participants answering at the same time.
The host is responsible in starting up the server, after that they wait for the clients. When the two clients are connected, they must send the message: READY to the server. When the server receives the two READY from the clients, the contest starts.
The server will display 3 questions one after another which can be answered in 30 secs each.
11+10 = 21
10+22 = 32
10+10 = 20
The participant with most correct answers wins.
At the end of the program, the server must show the results.
ex: Client1 WINS! 2/3
Client2: 1/3
arrow_forward
Kindly help me with this python program
write a system to support sending and receiving of quotes. The client program will connect to a quote server which in turn will send out a quote to that specific client. The quote server will read a file containing one-liner quotes stored on a text file that will be the basis for quotes sent to clients
arrow_forward
Write a script that opens a file containing a list of passwords and checks to see if the passwords are strong. 1. Save a list of five passwords in a text file. 2. Write a Python script that opens the text file and reads the passwords. 3. For each password, use regular expressions to check the password strength (I recommend creating a module to do this). For a password to be considered strong, it must satisfy the following requirements: + minimum length 8 characters + must contain one or more alphabetical characters [a-z] + must contain one or more Uppercase characters [A-Z] + must contain one or more numeric characters [0-9] + must contain one or more special characters [_$!]
arrow_forward
This question was rejected because lack of a text file, which I do not see a way to upload. I saved the first part of the file as an image because that is all I can upload. If that doesn't suffice, please advise how to include a text file.
In C++, I would like some help improving or making a better password lookup function for a Hash Table class/program I made,
The function: it is supposed to lookup a user password using their ID and name which I read in from a text file. The one I have only works for the first 10 records, which I highlighted below in the program.
string lookupPassword (string inUserID, string inUserName){
string thePassword;
...
return thePassword;
}
Here is part of the program thus far:
// Hash.cpp
#include <iostream>#include<string>#include<iomanip>#include<fstream>using namespace std;//node classclass nodeBST {private: //user data string userID; string userName; string userPW; //BST left and right children nodeBST*…
arrow_forward
Suppose you have Java source files under the directorieschapter1, chapter2, . . . , chapter34. Write a program to remove the statement package chapteri; in the first line for each Java source file underthe directory chapteri. Suppose chapter1, chapter2,. . . , chapter34are under the root directory srcRootDirectory.The root directoryandchapteridirectory may contain other folders and files. Use the followingcommand to run the program:java Exercise12_20 srcRootDirectory
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- I need to create a Transposition Cipher in Java that runs in Eclipse. The programs need to ask the user to encrypt or decrypt, read/accept a user's text file(.TXT) (NOT PLAIN TEXT), and save it as a new text file (.TXT). Please include as many comments as possible that help explains each line of code.arrow_forwardWrite a Java program that allows the user to specify a file name on the command line and prints the number of characters, words, lines, average number of words per line, and average number of characters per word in that file. If the user does not specify any file name, then prompt the user for the name.arrow_forwardcould you please code this on notepade.arrow_forward
- Write a Java program that reads from a URL and searches for a given word in the URL and creates a statistic file as an output. The statistic file needs to include some information from the URL. URL address Number of words in the URL page Number of repetitions for a given word displays the number of times the word appears. You need to have two functions, one for reading from the URL and the other function for searching the word.arrow_forwardSimple Encryption. Write a java program that reads from a file specified by the user and encrypt the content of the file using a simple shifting technique. Also, ask the user to input the shift size. Output the encrypted message to another file whose filename is also provided by the user. For example, Shift size: 1 Message read from the file: Hello Encrypted message: Ifmmparrow_forwardAnswer the given question with a proper explanation and step-by-step solution. Hello, I am trying to make a program that prints the contents of a file but whenever I try to run it, it just prints a bunch of question marks infinitely and this only happens when I run it on a UTM virtual machine(Linux terminal). It works fine when I run it on my Mac terminal so I am not sure if it has to do with the virtual machine or my program. Please help!! Image 1: cat.c Image 2: input.txt Image 3: output/resultsarrow_forward
- Write a program in HACK assembly, without using symbols, that implements the described Feistel encryption system. The initial key, Ko, will be stored in RAM[1], and the 16-bit plaintext will be stored in RAM[2]. The result of the encryption should be stored in RAM[0]. Your solution should be submitted in a file called "FeistelEncryption.asm".arrow_forwardImplement a simple version of the linux cat command in C++. Use the system calls open(), get() and close(). cat - reads a file as specified by the user and prints its contents. A typical usage is as follows: If from my terminal y run ./cat main.cpp the contents of main.cpp. will be printed. Your program cat can be invoked with one or more files on the command line; it should just print out each file in turn. Example: [terminal]$ ./cat main.cpp main2.cpp #include <iostream>using namespace std;int main(){cout << "Hello, World!"; return 0;}#include <iostream>using namespace std;int main(){cout << "Programming is great fun!";return 0;} As you can see content of main.cpp was printed first and the content of main2.cpparrow_forwardCreate a python module called MyEncryption to implement the Cesar cipher encryption. The module should contain two functions as follow; encrypt ( plainfilename, key) and decrypt ( cipherfilename, key). The encrypt function reads plaintext from a given filename, performs text encryption using the given key, and then writes the encrypted ciphertext in an output text file. The decrypt function reads ciphertext from a given filename, performs text decryption using the given key, and then writes the plaintext in an output text file. Create a text file with some text. Import the MyEncryption module in your main module and test both the encryption and decryption functions.arrow_forward
- In Javaarrow_forwardWrite a test client which takes a file path as an argument and reads each line one by one. The file can contain any number of DNA sequences (i.e., Strings.). After reading each DNA sequence, your code should print the DNA sequence first. Please follow the screenshot below for the output format. If the DNA sequence is valid DNA, report that and print out its complement as well as whether or not it is a Watson-Crick complemented palindrome. If the DNA sequence is not a valid DNA, only report that. Continue this process for each DNA sequence in the text file. Separate the outputs for each sequence by printing a line as shown in the screenshot. In your project directory, create a new directory named ‘in’. The in folder will contain the input text file, titled sequences.txt. To run the code, your program argument should be in/sequences.txt Method Summary. Return Type Method 1 boolean isValid(String DNA) 2 String…arrow_forwardImplement a simple version of the linux grep command in C++. grep - Looks through a file, line by line, trying to find a user-specified search term in the line. If a line has the word within it, the line is printed out, otherwise it is not. Use the system calls open(), getline(), close(). Requirements (examples run from. terminal) Your program grep is always passed a search term and zero or more files to grep through (thus, more than one is possible). It should go through each line and see if the search term is in it; if so, the line should be printed, and if not, the line should be skipped. [terminal]$ ./grep ! main.cpp main2.cppcout << "Hello, World!";cout << "Programming is great fun!"; The matching is case sensitive. Thus, if searching for world, lines with World will not match. Lines can be arbitrarily long (that is, you may see many many characters before you encounter a newline character, \n). grep should work as expected even with very long lines. For this,…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education