Quote:
do I need to rename the .scr to a .sh?
|
Well, yes, you probably do want to do that -- and here's why.
There are naming conventions that are worth your time to follow; e.g.,
- .sh: shell program source code
- .c C-language source code
- .awk AWK program source code
and lots of others.
The key phrase is "source code."
Although many folks will retain the
.sh extension on a shell program (and, consequently, will force anyone using that program to type
prog.sh), the way Linux is intended to work is that all you need to do is type the name of a program -- no extensions -- and it'll go to work. Source code is kept separate from executable.
Why it's a good idea to do this is really quite simple -- if you write a program (in any of the many languages available to you), chances are that as time goes on you're going to have a larger and larger collection of programs. If you keep your source code separate from the executable, you can easily edit the source without disturbing a program that may be in use by number of folks. That way, you can add features and test your changes without causing any problems until you're ready to "go live" with whatever changes you've made in the source.
What the
make utility does is take your source code and turn it into an executable; essentially, as colucix says,
make simply copies a shell program source file, eliminating the
.sh extension and changes the mode of the copy to make it executable. So, in your case, you would have two files,
week4prog1Rebecca.sh (the source) and
week4prog1Rebecca (the executable) -- you would simply enter (type)
./week4prog1Rebecca and hit the enter key to run it.
If you were to edit
week4prog1Rebecca.sh you would simply
Code:
make week4prog1Rebecca
to re-do the copy-and-change-mode.
Now,
make does not simply copy with other languages, notably C and its derivatives, what it does with a C program is compile it to a binary executable; you start with
prog.c, execute
make prog, and you wind up with an executable
prog (see the idea? source to executable with no extension?). For now, don't worry about those details, just bear mind the naming convention and remember that there's a tool,
make, that makes it a little easier for you.
As time goes on, you'll become familiar with the
make utility -- it's a great tool that makes you life much, much easier and all you have to do is stick with a few conventions to get a great deal of work done with minimal effort (well, less that otherwise would be the case, say).
A couple of other things to keep in mind, particularly if you're coming from a Windows background: no spaces in file names (ever); back slants (\) are
not the same thing as slashes (/); it's
directory, not
folder; file name don't need to be a sentence, but do need to make sense.
Best of luck with all of this.
Hope this helps some.