100 good unix habits

Discussion in 'NZ Computing' started by Aquilegia Alyssum, Dec 17, 2006.

  1. Aquilegia Alyssum, Dec 17, 2006
    #1
    1. Advertising

  2. Aquilegia Alyssum

    Fred Dagg Guest

    Fred Dagg, Dec 17, 2006
    #2
    1. Advertising

  3. In message <>, Fred Dagg wrote:

    > ... Install Windows ...


    Yes, that is something you soon learn to make a regular habit, don't you...
     
    Lawrence D'Oliveiro, Dec 17, 2006
    #3
  4. Lawrence D'Oliveiro, Dec 17, 2006
    #4
  5. Aquilegia Alyssum

    Fred Dagg Guest

    On Sun, 17 Dec 2006 18:37:54 +1300, Lawrence D'Oliveiro
    <_zealand> exclaimed:

    >In message <>, Fred Dagg wrote:
    >
    >> ... Install Windows ...

    >
    >Yes, that is something you soon learn to make a regular habit, don't you...


    Hmm. Um, yes, actually.
     
    Fred Dagg, Dec 17, 2006
    #5
  6. Aquilegia Alyssum

    jasen Guest

    jasen, Dec 17, 2006
    #6
  7. Aquilegia Alyssum

    Kent Smith Guest

    Kent Smith, Dec 17, 2006
    #7
  8. On Mon, 18 Dec 2006 10:27:37 +1300, Kent Smith wrote:

    > And there's only 10. :)


    Yes. A typo.

    I wondered how long it would be before someone picked at that.


    Aquilegia Alyssum

    --
    "The only way Vista client and Longhorn server would make sense
    would be if [the] company was doing a 'forklift upgrade' on its
    entire client-server infrastructure."
     
    Aquilegia Alyssum, Dec 17, 2006
    #8
  9. Aquilegia Alyssum

    Rob Guest

    Kent Smith wrote:
    > Lawrence D'Oliveiro wrote:
    >> In message <>,
    >> Aquilegia Alyssum wrote:
    >>
    >> http://www-128.ibm.com/developerworks/aix/library/au-badunixhabits.html?ca=lnxw01GoodUnixHabits
    >>
    >> Those aren't UNIX habits, they're UNIX shell habits.

    >
    > And there's only 10. :)
    >
    >

    Ah, but in *nix, there's usually 10 ways of doing any particular thing.

    --

    Rob
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    http://aspir8or.googlepages.com/linux_links
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


    "If you want to make an apple pie from scratch, you must first create
    the universe." - Carl Sagan
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    Rob, Dec 17, 2006
    #9
  10. In message <em3b82$oo5$-a-geek.org>, jasen wrote:

    > and this one of "good use of backslashes"
    >
    > ~ $ cd tmp/a/b/c || \
    > > mkdir -p tmp/a/b/c && \
    > > tar xvf -C tmp/a/b/c ~/archive.tar

    >
    > where their presence has no effect whatsoever!


    Whaddaya know ... bash is smart enough to assume a continuation if a line
    ends with one of those operators.

    But this might not apply to other shells.
     
    Lawrence D'Oliveiro, Dec 18, 2006
    #10
  11. Aquilegia Alyssum

    Murray Symon Guest

    On Mon, 18 Dec 2006 14:35:38 +1300, Lawrence D'Oliveiro wrote:

    > In message <em3b82$oo5$-a-geek.org>, jasen wrote:
    >
    >> and this one of "good use of backslashes"
    >>
    >> ~ $ cd tmp/a/b/c || \
    >> > mkdir -p tmp/a/b/c && \
    >> > tar xvf -C tmp/a/b/c ~/archive.tar

    >>
    >> where their presence has no effect whatsoever!

    >
    > Whaddaya know ... bash is smart enough to assume a continuation if a line
    > ends with one of those operators.
    >
    > But this might not apply to other shells.


    Jasen probably just missed the || and && symbols, I think.
    If you miss them with a quick eyeball scan you miss the if/else construct.

    Murray
     
    Murray Symon, Dec 18, 2006
    #11
  12. In message <1166427220.835135@ftpsrv1>, Murray Symon wrote:

    > On Mon, 18 Dec 2006 14:35:38 +1300, Lawrence D'Oliveiro wrote:
    >
    >> In message <em3b82$oo5$-a-geek.org>, jasen wrote:
    >>
    >>> and this one of "good use of backslashes"
    >>>
    >>> ~ $ cd tmp/a/b/c || \
    >>> > mkdir -p tmp/a/b/c && \
    >>> > tar xvf -C tmp/a/b/c ~/archive.tar
    >>>
    >>> where their presence has no effect whatsoever!

    >>
    >> Whaddaya know ... bash is smart enough to assume a continuation if a line
    >> ends with one of those operators.
    >>
    >> But this might not apply to other shells.

    >
    > Jasen probably just missed the || and && symbols, I think.


    No, Jasen was right--the continuation backslashes are not needed. Bash seems
    to assume automatic line continuation if the line ends with certain
    operators.
     
    Lawrence D'Oliveiro, Dec 18, 2006
    #12
  13. In message <em2lfp$ltc$>, Lawrence D'Oliveiro wrote:

    > In message <>, Aquilegia
    > Alyssum wrote:
    >
    >>

    >

    http://www-128.ibm.com/developerworks/aix/library/au-badunixhabits.html?ca=lnxw01GoodUnixHabits
    >
    > Those aren't UNIX habits, they're UNIX shell habits.


    Here's another one, a one-line script to expand tabs to spaces in a file
    in-place:

    TmpFile=$(mktemp) && cp "$1" $TmpFile &&
    expand -t 4 $TmpFile >"$1" && rm $TmpFile

    Note the use of "&&" operators to separate the steps: this way the sequence
    aborts if there is an error at any point, and hopefully you don't lose the
    original of your file. :)
     
    Lawrence D'Oliveiro, Dec 18, 2006
    #13
  14. Aquilegia Alyssum

    jasen Guest

    On 2006-12-18, Murray Symon <> wrote:
    > On Mon, 18 Dec 2006 14:35:38 +1300, Lawrence D'Oliveiro wrote:
    >
    >> In message <em3b82$oo5$-a-geek.org>, jasen wrote:
    >>
    >>> and this one of "good use of backslashes"
    >>>
    >>> ~ $ cd tmp/a/b/c || \
    >>> > mkdir -p tmp/a/b/c && \
    >>> > tar xvf -C tmp/a/b/c ~/archive.tar
    >>>
    >>> where their presence has no effect whatsoever!

    >>
    >> Whaddaya know ... bash is smart enough to assume a continuation if a line
    >> ends with one of those operators.
    >>
    >> But this might not apply to other shells.


    yeah, it doesn't work with tcsh for example.

    > Jasen probably just missed the || and && symbols, I think.
    > If you miss them with a quick eyeball scan you miss the if/else construct.


    In bash they work just the same with or without the backslashes.

    Bye.
    Jasen
     
    jasen, Dec 19, 2006
    #14
  15. In message <em2lfp$ltc$>, Lawrence D'Oliveiro wrote:

    > In message <>, Aquilegia
    > Alyssum wrote:
    >
    >>

    >

    http://www-128.ibm.com/developerworks/aix/library/au-badunixhabits.html?ca=lnxw01GoodUnixHabits
    >
    > Those aren't UNIX habits, they're UNIX shell habits.


    Here's another fun one: setting the title on a terminal window:

    echo -en '\033]2;New Window Title\007'

    or alternatively:

    echo -n $'\033]2;New Window Title\007'

    For extra credit, explain the difference between the two. :)
     
    Lawrence D'Oliveiro, Dec 20, 2006
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sens Fan Happy In Ohio
    Replies:
    26
    Views:
    794
    TNKEV
    Sep 23, 2005
  2. Aspect Ratio and photo album habits

    , Jul 24, 2006, in forum: Digital Photography
    Replies:
    9
    Views:
    533
    Dave Cohen
    Jul 24, 2006
  3. 10 biggest brain damaging habits

    , Mar 23, 2007, in forum: Computer Support
    Replies:
    14
    Views:
    705
    Frosty
    Mar 24, 2007
  4. Music listening habits

    , Nov 10, 2007, in forum: Digital Photography
    Replies:
    0
    Views:
    517
  5. Paul

    Need a way to see employeed surfing habits

    Paul, May 11, 2009, in forum: Wireless Networking
    Replies:
    78
    Views:
    1,887
    Leythos
    May 16, 2009
Loading...

Share This Page