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?
I recently switched my default shell to IPython, rather than bash, by creating an
Share
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-openbyxdg_open); to avoid name clashes (e. g. if there already is anxdg_openbesides thexdg-open) the replacement often is escaped in some way, e.g. by the hex value of the character (e. g.-by_2d,_by_5fetc.). You will probably know this from URL lines containing stuff like%20and the like. This all becomes either unreadable very quickly, or the rules for the name mangling are very complicated (there’s a trade-off).