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
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