From what I remember the “!” command in bash is to re-execute a command.
One way of doing this is to run the command history, then running the appropriate entry, !2028 to repeat command 2,028 for example.
What I used to do much more commonly was “repeat last command starting with …” to just repeat the last thing I ran. For example !vi would re-run the last command starting with vi.
I just tried this, and it did not work as expected. It ran a different command, not the last one. Has something changed? Is this expected behaviour, or a bug? Why did it run a different command instead of the last one?
($) /mnt/Storage/win10-share: vi ~/.mountShares.sh
($) /mnt/Storage/win10-share: !vi
Interesting. I do have multiple terminals running, but I’m not running the same commands on different terminals. I haven’t edited that .moveApps.sh file today, so I don’t know why it would open that one.