command_not_found_handle bash mechanism only passes single arg

Bug #155899 reported by Paul Archer
4
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

Binary package hint: bash

When bash encounters a command that it can't locate, it calls the function command_not_found_handle if available, which then usually calls the python command-not-found script.

But bash only passes the first argument from the command line on to command_not_found_handle. This is OK for the command-not-found script, but makes it difficult to extend.

For example, I have modified /etc/bash.bashrc to run this:
/usr/bin/python /usr/lib/command-not-found -- $1 || ssh $@ && return 0 || return 75

This allows me to type in the name of a machine I'd like to ssh to. As long as it isn't also the name of a program, then this works (and is very handy). But I can't do something like this:
parcher@myhost:$ remotehost -l archer
All that is passed to the command_not_found_handle function is 'remotehost', so the ssh never sees the other arguments.

Just to be clear: this is an issue with what is being passed to the command_not_found_handle function, and not an issue with what happens inside the function.

Matthias Klose (doko)
Changed in bash:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Mika Fischer (zoop) wrote :

This seems like a different use-case than what command-not-found was designed for. You may want to propose the idea to the bash developers at <email address hidden> . At seems like it could be useful, maybe they'll like it, too, and implement it :)

Changed in bash:
status: Confirmed → Triaged
Revision history for this message
Thomas R. (pumbaa80) wrote :

bug 233994 might have the same cause as this one

Revision history for this message
Thomas R. (pumbaa80) wrote :

> bug 233994 might have the same cause as this one

Sorry, accidental comment. Please ignore.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.