I am using bash 4.3 [on debian jessie 8.5, kernel 3.16.7-ckt25-2].

I am opening a console window (with xfce4) or a ssh session and enter shell commands. Sometimes later, shellexpansion stops working. Example:

ls /usr/lib/u*
ls: cannot access /usr/lib/u*: No such file or directory

Opening a new session (ssh in this case) and doing the same:

ls /usr/lib/u* /usr/lib/udisks2: total 397 -rwxr-xr-x 1 root root 1328 Sep 30 2014 udisks2-inhibit* .....

I compared the BASHOPTS (in the output of set) in both sessions show any differences. This happen very often, so I have really to get rid of it. But. after digging deeper, I found an alias like this, which caused it:

alias di='set -f; /ops/tools/di'

So, my final question is: How do I come to the same result, without making the "-f" permanent (I even don't find, where this is saved). SHOPT's are not the place.

Any help, pointers or further information are really welcome!

  • Ok, thanks for the hint about superuser/unix, looks right! The 'di' is a shell script, which wraps the execution of a tool,which I want to pass wildcard-like characters without the ugly escaping. It passes all commandline arguments without any modification/expansion to an application. So, this wrapper itself 'is too late' to disable expansion with 'set -f', the caller of the wrapper has to do it.
    – mabra
    Aug 6 '16 at 2:57

Not sure what di does, but I'd try:

alias di='set -f; /ops/tools/di; set +f'

in this case, set +f actually unsets the f [Disable file name generation (globbing).] flag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.