LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why does bash sometimes give me numbers in my prompt, but not all the time? (https://www.linuxquestions.org/questions/linux-newbie-8/why-does-bash-sometimes-give-me-numbers-in-my-prompt-but-not-all-the-time-4175482886/)

nerdofdarkness 10-31-2013 04:20 AM

Why does bash sometimes give me numbers in my prompt, but not all the time?
 
Most of the time my shell prompt looks normal.

However, if I cancel something with control-C, or if there's a file that's not found, the shell sometimes puts numbers in there as if it's telling me how many errors I've made.

Code:

user@verdant:~/Downloads > gem install taskjuggler-3.5.0.gem
^CERROR:  Interrupted
[1]user@verdant:~/Downloads > gem install taskjuggler
Fetching: mime-types-1.25.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /var/lib/gems
[1]user@verdant:~/Downloads > ^C
[130]user@verdant:~/Downloads > sudo gem install taskjuggler
Fetching: mime-types-1.25.gem (100%)

The [1] and [130] don't usually show up - they seem to indicate an error condition.

Why is bash doing this to me?

Thanks.

pan64 10-31-2013 05:06 AM

see the prompt settings: echo $PS1

ntu929 10-31-2013 05:19 AM

I also face this problem when there is some problem with the network driver.So do check it.


Quote:

Originally Posted by nerdofdarkness (Post 5055753)
Most of the time my shell prompt looks normal.

However, if I cancel something with control-C, or if there's a file that's not found, the shell sometimes puts numbers in there as if it's telling me how many errors I've made.

Code:

user@verdant:~/Downloads > gem install taskjuggler-3.5.0.gem
^CERROR:  Interrupted
[1]user@verdant:~/Downloads > gem install taskjuggler
Fetching: mime-types-1.25.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /var/lib/gems
[1]user@verdant:~/Downloads > ^C
[130]user@verdant:~/Downloads > sudo gem install taskjuggler
Fetching: mime-types-1.25.gem (100%)

The [1] and [130] don't usually show up - they seem to indicate an error condition.

Why is bash doing this to me?

Thanks.


jpollard 10-31-2013 07:26 AM

I believe that is the job control identification number.

When a command gets suspended (either directly or due to some command directing it), the shell assigns a number to the command stream. This allows you to resume that stream.

You should be able to list these with the "jobs" command that is built into bash.

nerdofdarkness 11-01-2013 12:07 AM

Quote:

Originally Posted by pan64 (Post 5055767)
see the prompt settings: echo $PS1


Code:

> echo $PS1
\[\033[0;31m\]$(returncode)\[\033[0;37m\]\[\033[0;35m\]${debian_chroot:+($debian_chroot)}\[\033[0;35m\]\u@\h\[\033[0;37m\]:\[\033[0;36m\]\w >\[\033[0;00m\]


So I guess "1" and "130" are 'returncode' values.

nerdofdarkness 11-01-2013 12:10 AM

Quote:

Originally Posted by jpollard (Post 5055840)
I believe that is the job control identification number.

When a command gets suspended (either directly or due to some command directing it), the shell assigns a number to the command stream. This allows you to resume that stream.

You should be able to list these with the "jobs" command that is built into bash.

'jobs' lists commands that were started in the current terminal.

Since I normally use at least two or three terminals, I usually have to use 'ps -ef' to list what's going on.


All times are GMT -5. The time now is 03:30 AM.