Timeline for Forcing an 'added' alias to every command
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 30, 2020 at 9:23 | history | edited | Scott - Слава Україні | CC BY-SA 4.0 |
added 1 character in body
|
| Aug 29, 2020 at 22:04 | answer | added | wjandrea | timeline score: 1 | |
| Aug 29, 2020 at 21:24 | answer | added | Scott - Слава Україні | timeline score: 1 | |
| Oct 7, 2014 at 20:54 | answer | added | alexis | timeline score: 1 | |
| Sep 11, 2012 at 22:02 | comment | added | Caleb |
@Mikel I think you could use the preexec() function to actually wrapper whatever was executing by fetching the command, running it yourself from inside the function, then returning some sort of error so that the shell doesn't go on to execute the command itself.
|
|
| Apr 27, 2011 at 19:45 | vote | accept | warren | ||
| Apr 26, 2011 at 23:35 | comment | added | Mikel |
I looked before, and couldn't find a way to do exactly this. As Caleb says, you can use preexec, but you don't want to run it inside the preexec (e.g. preexec() { time $1; }), because the shell still runs it after preexec returns. So the best we can do is something similar.
|
|
| Apr 26, 2011 at 22:38 | answer | added | Caleb | timeline score: 4 | |
| Apr 26, 2011 at 21:50 | answer | added | Gilles 'SO- stop being evil' | timeline score: 11 | |
| Apr 26, 2011 at 17:43 | answer | added | cjm | timeline score: 1 | |
| Apr 26, 2011 at 17:20 | history | asked | warren | CC BY-SA 3.0 |