- The problem statement, all variables and given/known data:
Problem 1:
I need to create a shell script the takes three arguments and echo's out "There once was a ____that____who like to_____"
The arguments go where the blanks are.
Problemt 2:
-Do an LS and store the listings in a file
-Open the file in emacs.
-create a macro that converts that single line to the command "mv file.txt file.dat"
-run the macro over the entire file.
-chmod +x the listing file
-run the file as a script.
- Relevant commands, code, scripts, algorithms:
For problem one my instructor provides me with this example:
echo -n "some argument"
echo $1
how I've been reading it is like a C++ code
cout << "Some argument"
cin >> argurment
- The attempts at a solution (include all code and scripts):
For problem 1 I've tried it many different ways, this is my latest attempt:
echo -n "There once was a "
echo $1
echo -n "that "
echo $2
echo -n "who liked to "
echo $3
echo -n "There once was a " $1 " that " $2 " who liked to " $3
I believe my teacher wants the echo to be just on one line. I dont want the code given to me, I'm really just hoping someone can show me what I'm doing wrong so I can correctly do it. There is a part b to this question and if I understand what I'm doing wrong in part a im positive I can do part b.
For problem 2 I've run an ls and moved all .txt files to a new file called change. From there I created a macro that searched for all .txt and replaced them with .dat. I'm having a hard time understanding how to mv this data to replace the old .txt files in the directory I copied them from.
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Portland Community College, Hillsboro, OR, United States, Mike Noel, CS 140u Intro to Unix
Link -PCC Class Schedule