Reputation: 933
I recently switched my default shell to IPython, rather than bash, by creating an IPython profile with automagic, autocall and other such features turned on. To make executables visible to the IPython environment, I've included %rehashx
to run automatically in my config files. The trouble with this is that commands with dashes in their names, such as xdg-open
, are not properly translated into magic commands, and thus require using the shell-escape syntax to run. Is there a way to automagic commands with dashes, so that I can more closely emulate bash-like calling of such commands?
Upvotes: 1
Views: 494
Reputation: 59516
You will have to live with this.
If identifiers are handled across language boundaries (in this case bash/Python) you will have problems if the languages' rules for identifiers allow different things (in this case the -
is allowed in bash but not in Python). One way to solve this is name mangling. Sometimes this is done, e. g. by replacing offending characters with allowed characters (e. g. xdg-open
by xdg_open
); to avoid name clashes (e. g. if there already is an xdg_open
besides the xdg-open
) the replacement often is escaped in some way, e.g. by the hex value of the character (e. g. -
by _2d
, _
by _5f
etc.). You will probably know this from URL lines containing stuff like %20
and the like. This all becomes either unreadable very quickly, or the rules for the name mangling are very complicated (there's a trade-off).
Upvotes: 2