Unix help

Discussion in 'Mac Programming' started by dukebound85, Sep 20, 2006.

  1. macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #1
    How do I make a directory "office" in my cwd and move all .doc and .xls file into it from the current directory.


    I can do it in 2 but was wondering if it can be done in one line


    Thanks for any help. You guys are awesome
     
  2. macrumors 603

    janey

    Joined:
    Dec 20, 2002
    Location:
    sunny los angeles
    #2
    if you have two commands, separate them with semicolons into one line. should work :D


    stupid me confused the two. :(
     
  3. thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #3

    Wow is it really that simple?
     
  4. macrumors regular

    rtharper

    Joined:
    Sep 6, 2006
    Location:
    Oxford, UK
    #4
    uhh, it's USUALLY a semicolon in every shell i've worked on..

    Code:
    mkdir office; mv *.doc *.xls ./office/
     
  5. thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #5

    thanks that definitly works!

    so in general, to execute more than one command in a sequential order, you just seperate with semi-colons?
     
  6. macrumors regular

    rtharper

    Joined:
    Sep 6, 2006
    Location:
    Oxford, UK
    #6
    you got it, yo ucan execute an infinite number of commands on one line by just separating them with semicolons.

    I love seeing someone that still takes the time to learn the commandline. It's still my preferred way to tell a computer what to do. You won't ever find my machine on without a commandline window open ;)
     
  7. macrumors 603

    janey

    Joined:
    Dec 20, 2002
    Location:
    sunny los angeles
    #7
    Argh i had a brainfart.
    yeah, it's a semicolon, garrrr. :( :mad: :mad:
     
  8. thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #8

    Yea, I am finding it to be alot more flexible than using a gui. There is so much you can do it seems.

    I wouldn't be suprised if I too will start using the command line over the gui ever so slowly!
     
  9. macrumors 68020

    dogbone

    Joined:
    Sep 16, 2005
    Location:
    S33.687308617200465 E150.31341791152954
    #9
    However you would not be able to 'execute' because you'd never finish typing in the infinite number of commands.

    Sorry I just had to say that. I'll go away now.
     
  10. macrumors regular

    rtharper

    Joined:
    Sep 6, 2006
    Location:
    Oxford, UK
    #10
    I kinda hate you right now :p
     
  11. thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #11

    haha nice
     
  12. macrumors regular

    Joined:
    Sep 24, 2006
    Location:
    Cambridge UK
    #12
    The slash on the end is redundant. Apache uses that for web access, but this is hardly web access.
     
  13. macrumors 6502

    Joined:
    Mar 7, 2006
    Location:
    Knutters Knoll, Melbourne
    #13
    Not quite infinite. If you type "getconf ARG_MAX" it tells you the number of bytes of args + environ for exec(). I think even "ls *" will fail for a sufficiently large number of files, I know tar does.
     

Share This Page