[sf-lug] Need help with an Linux assignment script

Clyde Jones slash5toaster at gmail.com
Tue Apr 29 05:04:13 PDT 2008


On Mon, Apr 28, 2008 at 8:07 PM, Timothy Wang <timothyjwang at yahoo.com> 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
>
>  twang03 at hills:~ $ vi chk
>
>  #!/bin/bash
>  #1st argument if filepath exists, output in readable sentences
>
>  if [ $# -lt 2 ]; then
>     echo "chk: need -f or -u file or user" >&2
>     exit 1
>  fi
>
>  if [ ! "$1" = -f ] && [ ! "$1" = -u ]; then
>     echo "chk need -f or -u plus file or user" >&2
>     exit 1
>  fi
>  # =====    ============================
>  if [ "$1" = -f ]; then
>
>     if [ -h "$fname" ]; then
                   ^^^^^^^^
First, you never assigned fname anywhere that makes all the rest of
the code not work properly.


<deleted>
-- 
We are what we think. All that we are arises with our thoughts. With
our thoughts, we make the world.
-Buddha




More information about the sf-lug mailing list