Revision Question 3 on Linux. Please explain the shell script commands in the context of post execution.
You have just logged in and have a directory called "novel" in your home directory containing the following files:
chapter1.docx chapter2.docx chapter3.docx draft.pdf save
where "save" is itself a directory and contains the files
Attributes.txt draft.pdf.1 draft.pdf.2 draft.pdf.3 indexA.txt indexB.txt list1.txt list2.txt
a) Describe the results you would expect when executing the following shell commands:
i) ls novel/save/*A*
ii) ls novel/*r[23]*
iii) rmdir novel
iv) ls novel | wc -l
v) rm -r novel/save
(assume each command is run when the directory "novel" is as described above)
b) Consider the following short shell script
#!/bin/sh
cd $1
cnt = ` ls save/$2* | wc -l`
for i in $2*
do
cnt=$((cnt+1))
cp $i save/$i$cnt
done
If this script is stored in a file called arch, what would be the effect of running this shell command:
./arch novel draft
c) Describe the underlying design principle behind the Linux command set - often called the "UNIX philosophy".
a) i) list all files that contain A So it will print 3 indexA.txt
2) list all files that contain r in dir Novel
3) The rmdir command removes novel directory
4) Number of lines without filename in Novel - it should give 6
5)rm -r novel/save would delete the directory named “save” and all files in it.
Revision Question 3 on Linux. Please explain the shell script commands in the context of post...
Write a shell script called GetMyStuff.sh that will provide the above information (the script must be a executable, and must work regardless of which directory it is in). Also, just saying cat MyStuff.txt is not sufficient. (1.0%) A pipeline is the combination of at least 2 commands, where the output of command1 is the input for command2. The syntax is command1 | command2 where | is the pipeline operator. Read the man pages about the ls and wc commands. Devise...
You are currently running/debugging a shell script program in the foreground that seems to be in an infinite loop, to terminate/kill the shell script program. 7. (type/enter - control C to send a "program interrupt" ) or (contact the sysadmin person to kill your shell script program) 8. The UNIX/Linux exit command entered on the KORN shell command line will exit the shell session properly (best practice). [True / False] When killing a background process with the kill command you...
Write a script using simple shell commands. The script takes a command line argument that specifies a directory dir. The script first changes directory to dir, then prints the following in sequence: (a) A line starting “Current date and time: ”. Then on the same line, the current time and date. (b) A line starting “Current directory is : ”. Then, on the same line, the absolute pathname of the current working directory. (c) An empty line (d) The line...
Please help with this linux lab. Please include screenshots as I keep getting errors when I attempt this lab. Thank you in advance Example 1 Enter the system root directory cd / pwd [this command prints working directory] Here is how to go back to your home directory: cd ~ pwd Example 2 Use the Change directory command cd /labs/lab1/ohio inside the ohio folder use the Touch command to create a file called ohiostate.txt /labs/lab1/ohio/touch ohiostate.txt Use the pwd and...
Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell variables, and .profile script file, echo SHELL, HOME, PATH, MAIL and TERM are predefined shell variables. You can use the value of a shell variable in a shell command putting $ in front of it. For example, to display the value of the HOME directory of the user, specify $HOME in the echo command like echo $HOME. Do not give just the value of...
Please answer the following questions because I am not understanding it Description Investigate UNIX/Linux Files Systems by answering the questions below Requirements Save the recorded information in an ASCII file named “prog2.txt”. The file, “prog2.txt”, must be located in the directory: $HOME/itec400/homework Make sure the permissions on “prog2.txt” are set to 705. Solutions to problems below may require research on the web Record the questions below and the answers in “prog2.txt”. 1. What is the purpose...
LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check the output) Display the command(s) used to do the following: create an empty file called history by using just a redirection operator. Verify and show. Show/verify all results (i.e., all commands and their corresponding outputs). Wait 1 minute or more and then display the command(s) used to do the following: change the timestamp on the history file you just created. Verify/display the change. Show/verify...
Unix/Linux The purpose of this lab is to practice the commands to manage and organize files and directories: How would one go about this? Thanks. Task 1: Preliminaries: 1) If you have not already done so, create a directory called bin under your HOME directory. 2) If you have not already made a copy (using ftp) of the file called famous.dat from the Assignment#1, do that now. 3) Make bin the active/working directory. Task 2: Perform all of the following...
I need this done ASAP. Please write a bash shell script that does the following: Prints out how many users are logged on. This can be accomplished using who and wc. Prints out a list of currently logged on users. This can be accomplished using who, grep, regular expressions, and echo. Prints out how many processes you have running from past days, and a list of those jobs. Use `whoami` to get your username. Run ps -ef and see how...
Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a shell file called by (your name), your enrollment number, your program and the courses you study. Use the appropriate variables and display the above to the standard output (screen). . 2. Write A Shell Script to perform the following: Display the files and directories Print the date in 24 hour format Display the System id Display the current working directory Print the status of...