Search Results

Search found 1 results on 1 pages for 'cbhihe'.

Page 1/1 | 1 

  • where does the discrepancy between \# in PS1 and n in !n come from?

    - by Cbhihe
    Something has been gnawing at me for a while now and I can't seem to find a relevant answer either in man pages or using your 'Don't be evil' search engine. My .bashrc has the following: shopt -s histappend HISTSIZE=100 HISTFILESIZE=0 # 200 previous value Putting HISTFILESIZE to 0 allows me to start with a clean history slate with each new term window. I find it practical in conjunction with using a prompt that contains \#, because when visualizing a previous command before recalling it with !n or !-p, one can just do: $ history | more to see its relevant "n" value In my case, usually the result of: $ \history | tail -1 | awk '{print $1}' # (I know this is an overkill, don't flame me) equals the expanded value of # in PS1 minus 1, which is how I like it to be at all times. But then, sometimes not. At times the expanded value of # sort of "runs away". It's incremented in such a a manner that it becomes than $(( $(\history | tail -1 | awk '{print $1}')+1 )) Any pointers, anyone?

    Read the article

1