You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into trouble but fixed the problem myself. Am posting anyway for gaining a better understanding. I am trying to run a couple of commands with entr and expand one of the commands with parameter expansion. I created a function in .profile
entrtaskprojfunction () {
ls ~/.task/pending.data | entr -c task project:$1 rc.gc=0 2>~/.task/taskerrormessages.txt | grep "\."
}
alias entrtaskproj='entrtaskprojfunction'
Now I want to be able to specify the project I want to work on and have it display the tasks within that project and have it reload upon changes to the task database.
The problem: I first didn't get it to clear the screen. I think was because of piping into grep not being part of the command entr runs. I know that you can run two commands like in #7 but that doesn't work due to the double-quotes which I need for both the shell parameter expansion. Now I put sh -c in front and add double-quotes around both commands. I thus needed to change the quotes around the expression for grep to single-quotes. This did the trick. But suppose I want to have entr run commands which require double-quotes themselves (e.g. displaying with echo what project the tasks belong to). Is there a shell inbuilt way of managing such cases? Or would it be necessary to create a script for this?
Here my code which solved the problem:
entrtaskprojfunction () {
ls ~/.task/pending.data | entr -c sh -c "task proj:$1 rc.gc=0 2>~/.task/taskerrormessages.txt | grep '\.'"
}
If nobody feels like answering to this just delete the issue, I understand that this is not really entr-related but due to me being rather new to the shell.
Thanks!
Jaker
The text was updated successfully, but these errors were encountered:
Hello there!
I ran into trouble but fixed the problem myself. Am posting anyway for gaining a better understanding. I am trying to run a couple of commands with entr and expand one of the commands with parameter expansion. I created a function in .profile
Now I want to be able to specify the project I want to work on and have it display the tasks within that project and have it reload upon changes to the task database.
The problem: I first didn't get it to clear the screen. I think was because of piping into grep not being part of the command entr runs. I know that you can run two commands like in #7 but that doesn't work due to the double-quotes which I need for both the shell parameter expansion. Now I put sh -c in front and add double-quotes around both commands. I thus needed to change the quotes around the expression for grep to single-quotes. This did the trick. But suppose I want to have entr run commands which require double-quotes themselves (e.g. displaying with echo what project the tasks belong to). Is there a shell inbuilt way of managing such cases? Or would it be necessary to create a script for this?
Here my code which solved the problem:
If nobody feels like answering to this just delete the issue, I understand that this is not really entr-related but due to me being rather new to the shell.
Thanks!
Jaker
The text was updated successfully, but these errors were encountered: