Thread View: gnu.bash.bug
3 messages
3 total messages
Started by Roland McGrath
Wed, 21 Jun 1989 03:59
history numbers are wrong
Author: Roland McGrath
Date: Wed, 21 Jun 1989 03:59
Date: Wed, 21 Jun 1989 03:59
4 lines
649 bytes
649 bytes
The history number displayed by \# in PS1 does not correspond to the numbers used in ! history references or the `history' builtin. The numbers given by \# start at 1 with each bash invocation, while the real history numbers start at the beginning of .bash_history.
history numbers are wrong
Author: Brian Fox
Date: Wed, 21 Jun 1989 16:16
Date: Wed, 21 Jun 1989 16:16
34 lines
1593 bytes
1593 bytes
From: roland@ai.mit.edu (Roland McGrath) Date: Wed, 21 Jun 89 12:59:59 JST The history number displayed by \# in PS1 does not correspond to the numbers used in ! history references or the `history' builtin. The numbers given by \# start at 1 with each bash invocation, while the real history numbers start at the beginning of .bash_history. The number display by \# is not the history number. Here is some text from FEATURES: Here is the comment next to the decode_prompt_string function. /* Return a string which will be printed as a prompt. The string may contain special characters which are decoded as follows: \t the time \d the date \n CRLF \s the name of the shell \w the current working directory \u your username \h the hostname \# the command number of this command \<octal> character code in octal \\ a backslash */ It appears that more than one person wants the behaviour of "\!" in csh. However, I have been wondering about other possible ways of handling prompt strings, including standard word evaluation of it. Brian
Re: history numbers are wrong
Author: Thomas Thyberg
Date: Thu, 22 Jun 1989 12:22
Date: Thu, 22 Jun 1989 12:22
38 lines
1743 bytes
1743 bytes
In article <8906210400.AA08380@hobbes.ai.mit.edu> roland@AI.MIT.EDU (Roland McGrath) writes:
>The history number displayed by \# in PS1 does not correspond
>to the numbers used in ! history references or the `history' builtin.
>The numbers given by \# start at 1 with each bash invocation,
>while the real history numbers start at the beginning of .bash_history.
This seems to fix that problem. I'm not sure this is the 'right' way of
fixing it, but it works.
*** history.c.orig Tue Jun 13 12:03:19 1989
--- history.c Thu Jun 15 12:52:03 1989
***************
*** 354,361 ****
line = (char *)xrealloc (line, line_size += TYPICAL_LINE_SIZE);
}
line[i] = '\0';
! if (line[0])
add_history (line);
}
free (line);
fclose (file);
--- 354,364 ----
line = (char *)xrealloc (line, line_size += TYPICAL_LINE_SIZE);
}
line[i] = '\0';
! if (line[0]) {
! extern int current_command_number;
! current_command_number++;
add_history (line);
+ }
}
free (line);
fclose (file);
--
Thomas Thyberg INET : thomas@prosys.se
Programsystem AB UUCP : ...!{uunet,mcvax}!sunic!prosys!thomas
Teknikringen 2A PHONE: +46 (0)13 21 40 40
S-583 30 Linkoping, Sweden FAX : +46 (0)13 21 36 35
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads