# bash tabbing for autocompletion escapes $

**URL:** <https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411>\
**Category:** SLES Configure-Administer\
**Created:** [September 8, 2015, 10:47pm UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411 "2015-09-08T22:47:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinesh\_suse](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dinesh\_suse](https://forums.suse.com/u/dinesh_suse)\
**Post date:** [September 8, 2015, 10:47pm UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/1 "2015-09-08T22:47:55Z")

</div>

Hi, I am using SLES 11 SP3 on an AWS EC2 instance. I have two different bash versions on two different servers.

In shell (GNU bash, version 4.2.47(1)-release (x86\_64-suse-linux-gnu)), when I hit tab for autocompletion, the “$” is escaped after the variable name is completed, but if there is no completion then it just bells. E.g.

[FONT=Courier New]$ ls $JDK\_H[/FONT]  
results in  
[FONT=Courier New]$ ls \$JDK\_HOME (with a trailing space)[/FONT]

On an old GNU bash, version 3.2.51(1)-release (x86\_64-suse-linux-gnu), it did not escape the “$” after completion which is what I would like.

How do I get the old behavior in the new bash? Am I missing some setup options. FWIW these are my shell options:

[FONT=Courier New]BASHOPTS=checkwinsize:cmdhist:expand\_aliases:extglob:extquote:force\_fignore:histappend:interactive\_comments:login\_shell:progcomp:promptvars:sourcepath  
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor[/FONT]

Thanks

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [September 8, 2015, 11:47pm UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/2 "2015-09-08T23:47:47Z")

</div>

Out of curiosity, how did you get the newer bash on there? Is that  
something you pulled from SUSE, or a version you added manually, or maybe  
on another Linux distribution?

What happens if you start by using double-quotes before your ‘$’ symbol?  
[color=blue]

> ls "$JDK\_H[/color]

On my bash 3.x system it still behaves properly, and I’m not sure if it  
will help 4.x (which I do not have to test) but maybe it’ll help make  
things more-clear for bash.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![dinesh\_suse](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dinesh\_suse](https://forums.suse.com/u/dinesh_suse)\
**Post date:** [September 9, 2015, 1:40am UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/3 "2015-09-09T01:40:29Z")

</div>

> how did you get the newer bash on there?  
> It came in a standard distro on EC2. I don’t think I did anything special to get that. Not applied any patches or anything.

> What happens if you start by using double-quotes before your ‘$’ symbol?  
> I suppose in normal usage one wouldn’t want to do that. But I tried. It does not even expand the shell variable.

[FONT=Courier New]$ ls "$JD[/FONT]

just bells and does not become JDK\_HOME

I also tried a few more things, hoping something would shed a light on it.  
“shopt -s compat31” – did not complete at all.  
“shopt -s compat32” – escapes the $  
“sh” – the standard shell (4.2) worked fine, completing to “ls $JDK\_HOME”

It this a bug?

This is what I get from uname:  
[FONT=Courier New]$ uname -a  
Linux ip-10-0-0-84.ec2.internal 3.12.44-52.10-default #1 SMP Wed Jul 15 22:18:05 UTC 2015 (a6f3717) x86\_64 x86\_64 x86\_64 GNU/Linux  
[/FONT]

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [September 9, 2015, 1:54am UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/4 "2015-09-09T01:54:52Z")

</div>

Maybe it is worthwhile to post in the forum specific to EC2 instances, in  
case something they are doing is really off. For what it is worth, the  
kernel version I have from a SLES 11 SP4 box I built today is  
3.0.101-63-default so that, at least, is very different. I’m not sure  
what the SP3 kernel is these days, but I think it’s still in the 3.0.101  
area, so I think yours is quite a bit off from what is expected. Amazon  
may have done some tweaking.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![dinesh\_suse](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dinesh\_suse](https://forums.suse.com/u/dinesh_suse)\
**Post date:** [September 9, 2015, 6:33am UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/5 "2015-09-09T06:33:12Z")

</div>

I doubt if this has anything to do with AWS, unless AWS is building the whole login / profile setup. I would also be curious is if this is a bug or a feature 🙂 It is surely very frustrating.

This seems to afflict only “cd”. The . /etc/profile.d/bash\_completion.sh is bracketed for bash 4.1 or greater. And there are a lot more complete options in this version compared to my older sles systems.

[FONT=Courier New]  
$ cd $JD

> > > > becomes cd $JDK\_HOME  
> > > > $ echo $JD  
> > > > becomes echo $JDK\_HOME  
> > > > $ ls $JD  
> > > > becomes ls \$JDK\_HOME

$ shopt -s  
checkwinsize on  
cmdhist on  
expand\_aliases on  
extglob on  
extquote on  
force\_fignore on  
histappend on  
interactive\_comments on  
login\_shell on  
progcomp on  
promptvars on  
sourcepath on

[/FONT]

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [September 9, 2015, 6:39am UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/6 "2015-09-09T06:39:44Z")

</div>

If you say so. I just patched my SLES 11 SP3 AWS system with all of the  
latest patches and I am using this kernel:

Linux mybox #1 SMP Thu May 28 08:25:11 UTC 2015 (dc083ee) x86\_64 x86\_64  
x86\_64 GNU/Linux

Since that’s nothing at all like yours, I can only conclude that your box  
is vastly different, and maybe not even SLES. Note: openSUSE != SLES.  
Are you sure you are not using an openSUSE version of some sort, maybe  
13.2 instead of SLES 11 SP3? That would explain how you have a bash 4.x  
kernel, though my openSUSE laptop (this box) still does not behave like  
your system does.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)\
**Post date:** [September 9, 2015, 2:17pm UTC](https://forums.suse.com/t/bash-tabbing-for-autocompletion-escapes/27411/7 "2015-09-09T14:17:28Z")

</div>

> [@](#):
>
> On Wed 09 Sep 2015 03:39:44 AM CDT, ab wrote:
> 
> If you say so. I just patched my SLES 11 SP3 AWS system with all of the  
> latest patches and I am using this kernel:
> 
> Linux mybox #1 SMP Thu May 28 08:25:11 UTC 2015 (dc083ee) x86\_64 x86\_64  
> x86\_64 GNU/Linux
> 
> Since that’s nothing at all like yours, I can only conclude that your  
> box is vastly different, and maybe not even SLES. Note: openSUSE !=  
> SLES. Are you sure you are not using an openSUSE version of some sort,  
> maybe 13.2 instead of SLES 11 SP3? That would explain how you have a  
> bash 4.x kernel, though my openSUSE laptop (this box) still does not  
> behave like your system does.

Hi  
That system is SLE 12… kernel is up to date, but not bash (4.2-75.2).

–  
Cheers Malcolm Â°Â¿Â° LFCS, SUSE Knowledge Partner (Linux Counter #276890)  
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel  
3.12.44-52.10-default If you find this post helpful and are logged into  
the web interface, please show your appreciation and click on the star  
below… Thanks!
