Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
, followed by a tab, it autocompletes to show the actual command.
In bash, on the other hand, when I type
Code:
bash# !command
, followed by a tab, it does not autocomplete and I have no way of knowing what command is actually going to be executed. However, noone wants to use The Clown SHell; can I get this feature in bash?
bash# command (no exclamation) + tab DOES autocomplete
unless there is more than one match in which case hitting tab a second time will give you the list of matches.
Bash does support history expansion. There's a fair bit of info in the man page so I won't quote it, but if you search in it for HISTORY EXPANSION (in upper case) it's explained reasonably well.
Indeed. Not of any particular worth for long commands you'd want to rip out of the history due to their length, though.
OK you're talking about history rather than expansion.
My own preference is to do "set -o vi" as I do with ksh. Doing "esc-k" then will let me scroll through shell history. Once there I can do /pattern to search for a specific pattern in shell history. One of my favorites in doing this however is that I can simply hit "v" once I have the command back and that will open a vi session with the command in it - great for working out complicated pipelines then incorporating them within for loops.
When you specify `set show-all-if-ambiguous on' in .inputrc (the readline configuration file), you only have to press TAB once in bash to get the list of possible completions. Re-login after modifications:
Code:
# Produce list of all possible completions at single tab
set show-all-if-ambiguous on
# \[\e[0;34m\] : start blue
# \! : show history number of command
# \[\e[0m\] : stop blue
# \[\e[1;32m\] : start light green
# $(stoppedjobs) : execute shell function `stoppedjobs' which
# returns `%' plus number of jobs
# (see http://www.fvue.nl/wiki/Bash:_My_configuration)
# \[\e[0m\] : stop light green
# \u : show username
# \h : show hostname
# \w : show working directory
export PS1=$'\[\e[0;34m\]\!\[\e[0m\]\[\e[1;32m\]$(stoppedjobs)\[\e[0m\]:\u@\h:\w> '
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.