[sf-lug] Need help with an Linux assignment script
Timothy Wang
timothyjwang at yahoo.com
Tue Apr 29 00:38:44 PDT 2008
Hi Asheesh,
http://fog.ccsf.cc.ca.us/~gboyd/cs160b/asmt02.pdf
Below is also another question that I tried to understand and add to the script for assignment2
I am not sure about your question, but I'll try to answer with my understanding:
The functions Greg mentions on the assignemt 02 are not mandatory just here to help you. However if you decide to use them in your own version of the program 'chk' (which is the purpose of assmt 2) then this functions will apear when you do "cat chk" in your Assmt 02 script session. Now about copying segments of code (such as functions) from one program to another this can be done in many ways, as for my part since I am not familiar with the vi editor I almost always end copying the code by hand =|. Nevertheless try to see if you can do a copy/paste using the graphic user interface (GUI), it can sometimes be the easiest solution!
Jaime
On Mon, Apr 28, 2008 at 8:52 PM, Timothy Wang <timothyjwang at yahoo.com> wrote:
How do I add this to the asmt 02 script?
twang03 at hills:/pub/cs/gboyd/cs160b/asmt02 $ cat errfns
#!/bin/bash
#
# this file contains two function error() and fatal() as
# described below.
#
error () {
# error: output an error message and return
# the error messages contain the program name
# and are written to standard error
local prog=$(basename $0)
echo -e "$prog:ERROR: $*">&2
}
fatal() {
# fatal: output an error message and then exit
# the error() function is used.
error $*
# if you want to output a message about how to successfully
# run your program (called a 'usage message'), this would
# be the place to do it
# now exit with an error
exit 1
}
#
# your program goes here
#
twang03 at hills:/pub/cs/gboyd/cs160b/asmt02 $
--- On Mon, 4/28/08, Jaime Gago <gagojaime at gmail.com> wrote:
> From: Jaime Gago <gagojaime at gmail.com>
> Subject: Re: cs160b-gb: .exrc
> To: cs160b-gb at cloud.ccsf.cc.ca.us
> Date: Monday, April 28, 2008, 9:36 AM
> If you are talking about Assmt 02 and the copy of chk's
> output it's here:
>
> /pub/cs/gboyd/cs160b/asmt02/sample.script
>
> Jaime
>
> On Mon, Apr 28, 2008 at 2:10 AM, Timothy Wang
> <timothyjwang at yahoo.com>
> wrote:
>
> > Where is the file you asked to be checked?
> >
> > twang03 at hills:/pub/cs/gboyd/cs160b/samples here?
> >
> >
> >
> >
> ____________________________________________________________________________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile. Try it now.
> >
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > --
> > This is a CCSF mailing list, "cs160b-gb"; to
> unsubscribe, send
> > Internet e-mail to Majordomo at cloud.ccsf.cc.ca.us with
> a message
> > body of "unsubscribe cs160b-gb" (without the
> quotes).
> >
> >
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--
This is a CCSF mailing list, "cs160b-gb"; to unsubscribe, send
Internet e-mail to Majordomo at cloud.ccsf.cc.ca.us with a message
body of "unsubscribe cs160b-gb" (without the quotes).
--- On Mon, 4/28/08, Asheesh Laroia <asheesh at asheesh.org> wrote:
> From: Asheesh Laroia <asheesh at asheesh.org>
> Subject: Re: [sf-lug] Need help with an Linux assignment script
> To: "Timothy Wang" <timothyjwang at yahoo.com>
> Cc: "SF-LUG ML" <sf-lug at linuxmafia.com>
> Date: Monday, April 28, 2008, 10:08 PM
> On Mon, 28 Apr 2008, Asheesh Laroia wrote:
>
> > On Mon, 28 Apr 2008, Timothy Wang wrote:
> >
> >> I am doing an assignment in City College CS160b
> and was having
> >> difficulty understanding why it is not working.
> The assignment is posted
> >> on
> >>
> >> http://fog.ccsf.cc.ca.us/~gboyd/
> >>
> >> under cs 160b asmt02
> >
> > Interesting. Can you give the exact error message you
> get that makes you
> > say it fails?
>
> Also - do you know about using "bash -x" to show
> a trace of your shell
> script's execution? Just change the shebang (the first
> line with
> hash-bang #! in it) to "#!/bin/bash -x" instead
> of "#!/bin/bash".
>
> I find that helps me a lot when I'm trying to debug
> shell scripts.
>
> -- Asheesh.
>
> --
> Of all the animals, the boy is the most unmanageable.
> -- Plato
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the sf-lug
mailing list