No announcement yet.

shell programming

  • Filter
  • Time
  • Show
Clear All
new posts

  • shell programming

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

  • #2
    Maybe this... not sure what you are wanting:
    ls | xargs file


    • #3
      well i'll check when i get back home. hey do u go online often? [email protected] [email protected]
      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.


      • #4
        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).


        • #5
          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.


          • #6
            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 and i got access now. still havent forgotten about my linux prb. how u too