Find the answer to your Linux question:
Results 1 to 10 of 10
Some nice party tell me what && means, what it does? Search facists: searched for it but nothing. Oop, sorry - wrong forum....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    232

    What does && mean?


    Some nice party tell me what && means, what it does?

    Search facists: searched for it but nothing.

    Oop, sorry - wrong forum.
    All power is violence; all power is evil.
    Money As Debt

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    it means "and".

    eg, on a command line you might type:

    "make clean"
    then type "make"

    That means than after "make clean" finishes, you have to type in "make" afterwards.

    using && you can get the shell to execute 2 commands, one after the other without your intervention.

    eg: "make clean && make" will execute make clean, then make afterwards.

    Jason

  3. #3
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    232
    Thanks.

    So it's the same as:

    make clean; make

    All power is violence; all power is evil.
    Money As Debt

  4. #4
    Linux Engineer kriss's Avatar
    Join Date
    Jun 2003
    Posts
    1,113
    No, not really beacuse if you do something like "make ; make install" and "make" fails, "make install" will still be done, but with && when the program returns 0 (sucsess) && "see's" a that and does make install. But if it returns something other than 0 it doesnt do the next command in line.

  5. #5
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    232
    Right, fully understand - thanks.
    All power is violence; all power is evil.
    Money As Debt

  6. #6
    Linux Engineer
    Join Date
    Sep 2003
    Location
    Knoxhell, TN
    Posts
    1,078
    ...and now to thoroughly confuse you, && is also boolean AND in C/C++.... which means that a statement such as (2>3)&&(4!=5) is only true if BOTH sides of the statement are true...
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  7. #7
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    232
    Right, just about got my head round that - thanks!
    All power is violence; all power is evil.
    Money As Debt

  8. #8
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    "&&" is also a string consisting of two amperstands

    ...

    /me ducks the inevitable thrown stone or 42...
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  9. #9
    Linux Engineer
    Join Date
    Sep 2003
    Location
    Knoxhell, TN
    Posts
    1,078
    but to make it a literal string wouldn't you have to type it "&&"??
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  10. #10
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    232

    Confusion and amazement

    "&&" is also a string consisting of two amperstands
    consisting in two amperstands

    I have to say I'm shocked!
    All power is violence; all power is evil.
    Money As Debt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •