os-patches
os-patches copied to clipboard
$_ doesn't work
$_ does not work in Terminal 0.4
Steps
- cd Downlaods
- cd $_
Error Message
bash: cd: __bp_preexec_invoke_exec: No such file or directory
Launchpad Details: #LP1628992 Jahdo Lee - 2016-09-29 16:21:55 +0000
Hello,
Can you clarify what is the expected behavior?
Launchpad Details: #LPC Zisu Andrei - 2016-09-29 19:07:08 +0000
$_ means the last used file path.
for example,
ls wordpress-4.6.zip && unzip -l $_
same as
ls wordpress-4.6.zip && unzip -l !#:1
Launchpad Details: #LPC Jahdo Lee - 2016-09-30 06:12:01 +0000
Apologies I have not asked this before, but can you give an example of a terminal in which this works?
Launchpad Details: #LPC Zisu Andrei - 2016-10-01 21:05:38 +0000
P.R.C National Day 10.1 - 10.7
it works in Gnome-terminal in Ubuntu 16.04, Terminal/iTerm2 in Mac OS X
Oh, it occurs to me that I use zsh, not bash, in there environments.
Launchpad Details: #LPC Jahdo Lee - 2016-10-10 05:54:07 +0000
$_
is available in bash as documented here.
That said, I don't think this is a problem with the terminal app, but rather with the "bash-preexec" script included with elementary (/etc/bash-preexec
). This also appears to be fixed in more recent versions of 'bash-preexec'.
It looks like we added bash-prexec
in a patch here: https://github.com/elementary/os-patches/commit/eb320175fcb1c3191c413a6b9e0b5764262ebe76
So, moving to os-patches
since that's where this file comes from. This patch probably needs to either be dropped completely or just rebased on the upstream version as implied by this tweet
Linking the upstream issue here: https://github.com/rcaloras/bash-preexec/issues/39
We can either cherry-pick the upstream fix or rebase on latest released upstream version, but I think the latter is better because our bash_preexec is old (0.2.1) and it might be impossible to simply cherry-pick the fix to our version.
Closing as fixed in #295