Hi friends..
I hav a problem....
I dont know how to check .c files exists r not in a folder using IF in C shell script
actually i tried like this
if(=~ *.c)
even though some .c files or there in the current folder..it is not entering int o the if control statement...
Its sooooooooo urgent..can anyone help plzzzzzzzzzzzz
Thanks for ur kind reply friend...I tried now but it is giving error that confusion(ambuious)in *.c........
plz give me if anyother ways plzzzzzzzzzzzzzzzzzzzz
Thanks for ur kind reply expert...I tried this ..but it is always entering into if condition only,eventhough files r not there....
anyother idea plz give me friend................
[quote=cfajohnson;302285088]
Use a shell that is designed for scripting:
#!/bin/sh
is_file()
{
for file
do
[ -f "$1" ] && return
done
false
}
if is_file *.c
then
echo YES
else
echo NO
fi
Thank u very much for ur kind reply expert.. .......it is working under bourn shell but i wanted this same thing i nC SHELL SCRIPT...since i am new to this unix,,, icould not ble to do..plz helpp meeeeeee
If you're new to UNIX, start by doing things the right way. The C shell is not used for serious scripting; it has too many limitations, and it will be difficult to find good help because most scripters do not use it.
thanks for ur nice suggition..but i am working in a company guru...
this problem i am facing here... thats y i need it urgerntly.... plzzzzzzzzzzzzzzzz....