Write a Bash script called move that could replace the UNIX command mv. 'move' tries to rename the source file (using the UNIX command mv), but if the destination file exists, appends an index number, a sort of version number, to the destination file. So if the user types:
move a.txt b.txt
and b.txt already exists, move will rename the file to b.txt.1. If b.txt.1 already exists, move must rename the file to be b.txt.2, and so on, until the file can be successfully renamed with a name that does not already exist.
This is what I have so far but for some reason instead of indexing the filenames .1, .2, .3 it does .1, .1.1, .1.1.1 which I am confused on how to fix.
#!/bin/bash
if [ -f "$1" ] && [ -f "$2" ]; then
x = 1
while [ -f $2"."$x ]
do
x=$((x+1))
done
mv $1 $2"."$x
else
mv $1 $2
fi
In: Computer Science
he Sleeping Teaching AssistantA university computer science department has a teaching assistant (TA) whohelps undergraduate students with their programming assignments duringregular ofFce hours. The TA’s ofFce is rather small and has room for only onedesk with a chair and computer. There are three chairs in the hallway outsidethe ofFce where students can sit and wait if the TA is currently helping anotherstudent. When there are no students who need help during ofFce hours, theTA sits at the desk and takes a nap. If a student arrives during ofFce hoursand Fnds the TA sleeping, the student must awaken the TA to ask for help. If astudent arrives and Fnds the TA currently helping another student, the studentsits on one of the chairs in the hallway and waits. If no chairs are available, thestudent will come back at a later time
In: Computer Science
HF(g) + H2O(l) = H3O+(aq) + F-(aq)
In the following equilibrium in a closed system, indicate how the equilibrium is shifted by the indicated stress:
(a) Additional HF(g) is added to the
system.
(b) Water is added.
(c) Ca(NO3)2 solution is added, and CaF2
precipitates. (d) The volume is reduced.
(e) KOH is added.
(f) A catalyst is added.
In: Chemistry
: Write a paragraph to reflect on what you have learned about Microsoft access in terms of the difference between relational databases versus spreadsheets. Discuss ways in which a relational database could be useful for your work (if you have a job) or for your personal or professional projects (if you are a full-time student)
In: Computer Science
Consider two markets: the market for cat food and the market for dog food. The initial equilibrium for both markets is the same, the equilibrium price is $3.50$3.50, and the equilibrium quantity is 35.035.0. When the price is $9.75$9.75, the quantity supplied of cat food is 59.059.0 and the quantity supplied of dog food is 107.0107.0. For simplicity of analysis, the demand for both goods is the same.
Using the midpoint formula, calculate the elasticity of supply for dog food. Please round to two decimal places.
In: Economics
In: Finance
during the experiment, a student did not follow the procedure exactly as directed how will eact of these actions affect the weight of magnesium oxide( 7 on the report sheet)?
a-fumes were allowed to escape from the crucible(what is the compostion of the fumes)
b-water was not added to the crucible
c-the evaporation of water cused spattering
d-water was not completely removed by evaporation
2- the white powder often found on objects made of alminum is alminum oxide AL2O3 calculate the molar mass of the alminum oxide. if you wanted to make a molar quantity of alminum oxide in the lab how many Grams of alminum would you neeed to begin with?
3-a form of iron oxide commonrust has the formula Fe2O3 write a balanced equiation for its formation where would the oxygen come from?
4- if this experiment was carried out exactly as directed in the procudre section by a student in austrila for example should that student come up with a formula for the magnesium oxide other than MGO? why not ?
In: Chemistry
Assume all temperatures to be exact, and neglect significant
figures for small changes in dimension.
When exposed to sunlight, a hole in a sheet of copper expands in
diameter by 0.152% compared to its diameter at 71?F.
What is the Celsius temperature of the copper sheet in the sun?
Temp = ? ?C
In: Physics
Calculate the enthalpy of the reaction
4B(s)+3O2(g)?2B2O3(s)
given the following pertinent information:
B2O3(s)+3H2O(g)?3O2(g)+B2H6(g), ?H?A=+2035 kJ
2B(s)+3H2(g)?B2H6(g), ?H?B=+36 kJ
H2(g)+1/2O2(g)?H2O(l), ?H?C=?285 kJ
H2O(l)?H2O(g), ?H?D=+44 kJ
In: Chemistry
Do you think that CAFTA will have a major impact on the U.S. economy? Why?
In: Economics
Assignment 4, Fraction Comparable
Instructions
For this assignment, you will be updating the Fraction class from Assignment 1. To get started, you can either make a copy of your Assignment 1 Fraction.java or download the Fraction.java template at the bottom of this assignment.
You will need to update Fraction so that it implements the Comparable interface. This will require adding an implements statement to the class declaration as well as the compareTo method. You will also add a simplify method which reduces a fraction to its lowest terms and, to help you with this, a static method gcd which finds the greatest common divisor of two integers.
The requirements of the methods to be added are as follows:
When you have successfully written your simplify method, you should add calls to this method at the end of the Fraction(int n, int d) constructor and the add method. This will ensure that fractions are always stored in their simplest possible form.
To test your code, download the runner class student_fraction_runner.java (Links to an external site.) into the same folder that holds your Fraction.java. Execute the method student_fraction_runner.main, and verify that the output matches the sample run listed below. Remember to change the runner to test with other values to make sure your program fits all the requirements. We will use a similar but different runner to grade the program.
When you are ready, paste your entire Fraction.java class in the box below, click run to test the output, and click submit when you are satisfied with your results.
Note: once you have completely finished the assignment feel free to add more methods (e.g. multiply) or extend the functionality of your Fraction class to include, for example, negative fractions. Make sure you submit your assignment first before making any changes like this.
Sample Run
Fraction 1: 4/5 Fraction 2: 3/2 Fraction 3: 4/5 Compare fraction 1 to fraction 2: -1 Compare fraction 2 to fraction 1: 1 Compare fraction 1 to fraction 3: 0 Compare fraction 3 to fraction 1: 0 Compare fraction 2 to fraction 3: 1 Compare fraction 3 to fraction 2: -1
Milestones
As you work on this assignment, you can use the milestones below to inform your development process:
Milestone 1: Write the static gcd method and test this by calling it on pairs of integers from another class.
Milestone 2: Write the simplify method (you will probably find it useful to call the gcd method). Add calls to this method at the end of the constructor and the add method.
Milestone 3: Implement the Comparable interface and write the method compareTo. Download the runner file and ensure the results are as expected.
In: Computer Science
In: Economics
Site map for your e-commerce site. How many webpages this site has? What’s the name of each page? (You may use a rectangle box to represent a page).
In: Computer Science