Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's not exactly issue with program. But you .bashrc count line does not work properly. #7

Closed
polinom opened this issue Jun 15, 2012 · 3 comments

Comments

@polinom
Copy link

polinom commented Jun 15, 2012

Did not know where to write but. So i decide here.
After i put this in .profile on Lion.

export PS1="[$(t | wc -l | sed -e's/ *//')] $PS1"

It's behavior is strange.

  1. Does not changes the count after i delete task.
  2. If I do source twice it vill add one more count.

[1] [1] [1] [2] Igors-MacBook-Pro:tasks polinom$

here i run source .profile 4 times.

@darookee
Copy link

darookee commented Apr 3, 2013

As you overwrite $PS1 with this command
export PS1="[$(t | wc -l | sed -e's/ *//')] $PS1"
and also appending $PS1 it is normal behaviour that you get the taskinfo in your prompt more than once.

Does the count update after adding a task? Does it update after deleting after you hit enter again?

@joelittlejohn
Copy link

This is a bash question not a t issue so I think it can be closed. @polinom you are evaluating t | wc -l | sed -e's/ *//' once when you export your PS1, so the number never changes afterwards. You can see the problem if you try echo $PS1.

You need to instead set the expression into the PS1 env var so that it can be evaluated later. You either need to escape the $ chars like \$ or replace the double quote marks with single quotes. Since it looks like you do want to evaluate the $PS1 at the end of the expression (you want the original PS1 to be printed there) I think you need to choose the escaping option.

@pendashteh
Copy link
Contributor

Just sent a pull request to fix this. In the meantime, replace the line with the following:
export PS1='[$(t | wc -l | sed -e"s/ *//")]'" $PS1"

@sjl sjl closed this as completed in 2491982 Jan 8, 2018
tllilleh pushed a commit to tllilleh/t that referenced this issue May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants