Really need help for this C shell script

This is a discussion on Really need help for this C shell script within the Linux Programming forums, part of the Platform Specific Boards category; a script must : dis play time display current directory count all none hidden files and count directories must execute ...

  1. #1
    Unregistered
    Guest

    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 ="."
    else
    set dir = $argv[1]
    endif
    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***********
    else
    echo - n Date to day is\:
    set d = `date`
    echo $d[2] $d[3] $d[6]
    echo -n Current dir\:
    pwd
    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
    Posts
    11

    Just see whether this solves your problem

    #!/bin/sh

    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, 04: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, 02:47 PM
  4. Running 'exec' twice in one UNIX shell script
    By Zughiaq in forum Tech Board
    Replies: 2
    Last Post: 05-03-2003, 01:04 AM
  5. Arguements with a shell script
    By Doh in forum Linux Programming
    Replies: 1
    Last Post: 11-28-2002, 02:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21