Timeline for Bash for loop - can the commands in the loop be added to the shell's history?
Current License: CC BY-SA 4.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 29, 2020 at 8:27 | history | edited | Chris Davies | edited tags | |
| Apr 17, 2020 at 23:11 | answer | added | Arkadiusz Drabczyk | timeline score: 1 | |
| Apr 17, 2020 at 22:52 | comment | added | Lavya | @ArkadiuszDrabczyk Oh.. Thanks! | |
| Apr 17, 2020 at 22:39 | comment | added | Arkadiusz Drabczyk | This is because you have ignoredups in $HISTCONTROL. | |
| Apr 17, 2020 at 22:04 | history | edited | Lavya | CC BY-SA 4.0 | added 154 characters in body |
| Apr 17, 2020 at 21:48 | history | edited | Lavya | CC BY-SA 4.0 | added 551 characters in body |
| Apr 17, 2020 at 21:41 | comment | added | Lavya | @pLumo what if I put 5 separate echo lines in bash script and run it using source command. even then out of 5 echo lines it's showing only one in history. I'll edit the question to make it more clear | |
| Apr 17, 2020 at 10:58 | history | edited | Kusalananda♦ | CC BY-SA 4.0 | Modify title to better reflect question |
| Apr 17, 2020 at 10:44 | comment | added | pLumo | No need for a loop, echo 1; echo 2; in one line is a single command in history, too ... | |
| Apr 17, 2020 at 10:39 | comment | added | Kusalananda♦ | The individual echo commands are not added because the command being run is the compound for loop command (which is added to the history). It has nothing to do with subshells. | |
| Apr 17, 2020 at 10:37 | comment | added | Jetchisel | history has some more option. try help history | |
| Apr 17, 2020 at 10:35 | comment | added | Lavya | great. doing this the echo commands are added to history but oddly they don't output on current shell (nothing echoes.. l | |
| Apr 17, 2020 at 10:29 | comment | added | Jetchisel | for i in {1..5}; do history -s echo $i; done see help history | |
| Apr 17, 2020 at 10:21 | history | asked | Lavya | CC BY-SA 4.0 |