PDA

View Full Version : shell programming


WildHeart
12-18-2006, 01:43 AM
hey everyone howz it oging? am a complete noooooooooob to shell programming. i saw a few codes and applications and i already feel like running away lol i like my programming but with like java, vb, vb.net and even C++ but this hear looks all too new for me. so i decided i'd take it step by step like in java, the first prg they teach u is how to print HELLO WORLD so i do the same in bash. ok so here's my prb. say am in a directory and i want to find out how man files are jpegs and exe. like the result would b cout<<u have 10 jpegs and 5 exe
how do i get the name of a file and how do i check if it's an exe or not? a jpeg or not?
can someone just write a loop for this? a few lines checking if files are jpeg or not. no it's not an assignment although if u find it somewhere plz tell me lol cuz i'd rather read about it then ask
anything u can offer be it a complete answer or link or anything would b most appreciated. thnx and good day ^_^

ps. i think i put this in the wrong place but i wasnt so sure. sorry. didnt know if it were here or in general linux and id idnt want to double post on my first day lol

joshuapurcell
12-18-2006, 09:22 AM
Maybe this... not sure what you are wanting:ls | xargs file

WildHeart
12-18-2006, 09:29 AM
well i'll check when i get back home. hey do u go online often? wildheart20yea@hotmail.com aliendevils@yahoo.com
mayb we can chat then and talk about this. am out right helping some friends with work. thnx for the reply. hope i get to talk to ya online soon.

joshuapurcell
12-18-2006, 12:54 PM
Better yet just use file without ls. Go to any directory you are interested in and type:file *Add a | grep -v directory to the end to only get a list of files (instead of files and directories). I'm online, but the easiest way to communicate is right here through these forums since I never know when I'll be on. Responding to posts is easy and can happen at any time (especially since I'm at work most of the day).

WildHeart
12-19-2006, 12:28 AM
ok thnx a lot for ur help. as soon as iget back home i'll get on and see if u'r there. thnx again i look fwd to this.

WildHeart
12-27-2006, 05:19 PM
hey howz it going? i tried to pm u but i got no reply. i just got back. been hard. merry christmas. so umm i hope u reply back cuz i finally am back to my good ol beautiful pc :D and i got access now. still havent forgotten about my linux prb. how u too :D