I'm sorry if this doesn't go here, but I'm in depserate need of help with my last unix homework.
Anyways, I'm taking summer classes, and one of them is UNIX. I've understood everything thus far, but I'm having a killer time with how my instructor has worded the problems for shell scripting. I thought this would be fairly easy seeing as I've done some c++, but everything I do doesn't seem to want to work.
the example my instructor gives me is this:
echo -n "Some argument "
echo $1
So to me it looks like this
cout << "Some argument"
cin >> argument
My assignment is to create a shell script that takes three arguments and then echos out "There once was a ___ that ____ who liked to ____" and the arguments go where the blanks go.
I've done multiple tries on this, but 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
There is a part 2 to the question, but if I get an understanding as to what I'm doing wrong I think I can figure out the rest of it.
The last question I have is for my final assignment. I have 150+ .txt files in a directory. These are my instructions:
-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.
I put all the .txt files in new file called change. I went into emacs and made a macro where I searched for all .txt and then replaced them with .dat. I made the file executable, but I'm having a difficult time with the MV (move) command, is that suppose to be part of my marco? Or is it suppose to be text at the top of the page, something like this:
mv file.dat to file.txt?
Once again, I apologies if this isn't the correct thread, but I just had no idea what to do. Any help is appreciated also because my final is tomorrow, and I really just want to be able to understand what I'm doing wrong so I don't completely fail on this part of the final.