Thread: Really need help for this C shell script

  1. #1

    Really need help for this C shell script

    a script must :

    dis play time
    display current directory
    count all none hidden files
    and count directories

    must execute in any directory, and one dierectory only.

    I write like this.. but it does not work. Try hard to fix but no clue. Need help!! just a homework project for beginner...

    if ($#argv ==0 ) then
    set dir ="."
    set dir = $argv[1]
    if $1argv != 0 ) then
    echo you must point to a directory "
    echo Type "csh prog -h" for help
    set "csh prog -h" = $argv2
    if ($2argv == 0 ) then
    echo specific directory for the program to execute such as : csh prog /billshare
    echo *****end help***********
    echo - n Date to day is\:
    set d = `date`
    echo $d[2] $d[3] $d[6]
    echo -n Current dir\:
    echo display non hidden flies\:
    ls $dir
    echo count all file in current directory\:
    ls $dir |wc -l
    echo Count the directories\:
    ls -l $dir|grep -c ^d
    end if

  2. #2
    Registered User
    Join Date
    Sep 2001

    Just see whether this solves your problem


    date | cut -d ' ' -f 4
    echo $PWD
    echo "Number Of directories"
    ls -l| grep -c ^d
    echo "The list of Files"
    ls -l| grep -v ^d

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. shell script basic question
    By PedroTuga in forum Linux Programming
    Replies: 1
    Last Post: 09-09-2006, 03:24 AM
  2. invoking shell script
    By agoel01 in forum C Programming
    Replies: 1
    Last Post: 12-01-2005, 11:37 AM
  3. Game structure, any thoughts?
    By Vorok in forum Game Programming
    Replies: 2
    Last Post: 06-07-2003, 01:47 PM
  4. Running 'exec' twice in one UNIX shell script
    By Zughiaq in forum Tech Board
    Replies: 2
    Last Post: 05-03-2003, 12:04 AM
  5. Arguements with a shell script
    By Doh in forum Linux Programming
    Replies: 1
    Last Post: 11-28-2002, 02:20 PM