bash history & histignore , what's the dylio - Slackware

This is a discussion on bash history & histignore , what's the dylio - Slackware ; I think I had create .bashrc (although I read about other similar names), entered export HISTIGNORE="mc:ls:&:exit" Now , when after new login and use 'set', I have HISTIGNORE='mc:ls:&:exit' hmmm.. why single quote here? thought the file was wrong but it ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: bash history & histignore , what's the dylio

  1. bash history & histignore , what's the dylio

    I think I had create .bashrc (although I read about other similar names), entered export HISTIGNORE="mc:ls:&:exit"
    Now , when after new login and use 'set', I have HISTIGNORE='mc:ls:&:exit'
    hmmm.. why single quote here? thought the file was wrong but it does have double quote.

    AND it does not do the expected.

    Cheers

  2. Re: bash history & histignore , what's the dylio

    On Jan 29, 11:04 am, Sambo wrote:
    > I think I had create .bashrc (although I read about other similar names), entered
    > export HISTIGNORE="mc:ls:&:exit"
    > Now , when after new login and use 'set', I have HISTIGNORE='mc:ls:&:exit'
    > hmmm.. why single quote here?


    My guess is that the shell export builtin recognized the & as a
    special character, and put quotes around the string to preserve the
    context. Otherwise, it might have tried to fork off the export (a
    difficult thing to do ;-) ) and run :exit as a separate command.

    > thought the file was wrong but it does have double quote.


    Perhaps the shell figured that single quotes and doublequotes were
    equivalent in this case?

    >
    > AND it does not do the expected.


    What did you expect it to do? And what happened instead?

    > Cheers



  3. Re: bash history & histignore , what's the dylio

    Hallo, Sambo,

    Du meintest am 29.01.08:

    > I think I had create .bashrc (although I read about other similar
    > names), entered export HISTIGNORE="mc:ls:&:exit" Now , when after new
    > login and use 'set', I have HISTIGNORE='mc:ls:&:exit' hmmm.. why
    > single quote here?


    Why not? The bash always puts strings with white space into single
    quotes.

    Viele Gruesse
    Helmut

    "Ubuntu" - an African word, meaning "Slackware is too hard for me".


  4. Re: bash history & histignore , what's the dylio

    Helmut Hullen wrote:
    > Hallo, Sambo,
    >
    > Du meintest am 29.01.08:
    >
    >
    >>I think I had create .bashrc (although I read about other similar
    >>names), entered export HISTIGNORE="mc:ls:&:exit" Now , when after new
    >>login and use 'set', I have HISTIGNORE='mc:ls:&:exit' hmmm.. why
    >>single quote here?

    >
    >
    > Why not? The bash always puts strings with white space into single
    > quotes.
    >
    > Viele Gruesse
    > Helmut
    >
    > "Ubuntu" - an African word, meaning "Slackware is too hard for me".
    >

    What white space, the '&' oh the ':'?
    I do see the '&' as first one on all the help pages, hmm..
    I'll try that but...

  5. Re: bash history & histignore , what's the dylio

    Sambo wrote:
    > I think I had create .bashrc (although I read about other similar
    > names), entered export HISTIGNORE="mc:ls:&:exit"
    > Now , when after new login and use 'set', I have HISTIGNORE='mc:ls:&:exit'
    > hmmm.. why single quote here? thought the file was wrong but it does
    > have double quote.


    When you do

    export HISTIGNORE="mc:ls:&:exit"

    it means that HISTIGNORE is what _between_ the quote; the quote prevent
    the content of the string to be interpreted (with double quote some
    things are still interpreted such as variables; with single quote,
    almost nothing are interpreted, see man bash). Now when you type set;
    you will see a line that regenerate, when sourced, the content of the
    variable. In your case

    ISTIGNORE='mc:ls:&:exit'
    and
    ISTIGNORE="mc:ls:&:exit"

    are equivalent.

    Another example.

    FIRST="hello"
    SECOND="$FIRST"

    set | grep SECOND

    -> SECOND=hello

    because the content of SECOND is hello, and because hello does not
    contains special character, it is unnecessary to quote it.

    another example

    FIRST="hello&"
    SECOND="$FIRST"

    set | grep SECOND

    -> SECOND='hello&'

    Because if you type SECOND='hello&' ; you will have exactly the same as
    with the two lines of the example; the quote are necessary to preserve
    the special character &. The contents of the variables is what is
    between the quotes.

    Olive

    Olive




    >
    > AND it does not do the expected.
    >
    > Cheers


  6. Re: bash history & histignore , what's the dylio

    Olive wrote:
    > Sambo wrote:
    >
    >> I think I had create .bashrc (although I read about other similar
    >> names), entered export HISTIGNORE="mc:ls:&:exit"
    >> Now , when after new login and use 'set', I have
    >> HISTIGNORE='mc:ls:&:exit'
    >> hmmm.. why single quote here? thought the file was wrong but it does
    >> have double quote.

    >
    >
    > When you do
    >
    > export HISTIGNORE="mc:ls:&:exit"
    >
    > it means that HISTIGNORE is what _between_ the quote; the quote prevent
    > the content of the string to be interpreted (with double quote some
    > things are still interpreted such as variables; with single quote,
    > almost nothing are interpreted, see man bash). Now when you type set;
    > you will see a line that regenerate, when sourced, the content of the
    > variable. In your case
    >
    > ISTIGNORE='mc:ls:&:exit'
    > and
    > ISTIGNORE="mc:ls:&:exit"
    >
    > are equivalent.
    >
    > Another example.
    >
    > FIRST="hello"
    > SECOND="$FIRST"
    >
    > set | grep SECOND
    >
    > -> SECOND=hello
    >
    > because the content of SECOND is hello, and because hello does not
    > contains special character, it is unnecessary to quote it.
    >
    > another example
    >
    > FIRST="hello&"
    > SECOND="$FIRST"
    >
    > set | grep SECOND
    >
    > -> SECOND='hello&'
    >
    > Because if you type SECOND='hello&' ; you will have exactly the same as
    > with the two lines of the example; the quote are necessary to preserve
    > the special character &. The contents of the variables is what is
    > between the quotes.
    >
    > Olive
    >
    > Olive
    >
    >
    >
    >
    >>
    >> AND it does not do the expected.
    >>
    >> Cheers


    Well , ok I see why it changed the quotes (because it is written to represent strings in single quote)
    I understand ( after second reading ) that it may not put quotes around it when dumping the environment.
    BUT
    '&' supposed to be special match to bash ( no repeats, forgot it was special in 50 other ways ), maybe I was wrong not to put it at the beginning. All the pages I saw on this show it at the beginning and in
    double quotes.
    So , I changed it to export HISTIGNORE="$:mc:ls:exit:du:df"
    That didn't work, so then I tried both single quotes forward and backward('`).
    With those the variable didn't even get set. After I restored doubles it wouldn't get set even after reboot ??? ^%&*&^*^*6 what ta hell did I do?
    I smell the old window treatment coming on , REINSTALL , at least I wont have to wait to download
    100's of megabytes of updates.

    OK. I went to my other computer , crated .bashrc but this time I didn't use the '&'.
    There too the variable doesn't get set with doubles , without '&' or with , in the first position.
    And I haven't messed around with this there, till now, I swear.

    Just started KDE on the first comp and my conqueror background color was changed to black , SCARY .

    Cheers




+ Reply to Thread