3 ms·
Indeed, always prefer ./* to * I often wish there was a convenient way of doing such an operation in the shell: if path start with "/", leave it, otherwise pre
by PhilipRoman 1y ago
Indeed, always prefer ./* to *
I often wish there was a convenient way of doing such an operation in the shell: if path start with "/", leave it, otherwise prepend "./"
- quotemstr 1y ago> I often wish there was a convenient way of doing such an operation in the shell: if path start with "/", leave it, otherwise prepend "./" Both bash and zsh have enough functionality exposed via shell functions and variables for you to define a keybinding that does exactly this, interactively. Good idea. Did you mean an interactive command? Or something else?
- PhilipRoman 1y agoI meant non-interactive, for use in scripts which take user input. We already have "--" for end of options, but the support for it is not universal and even with that some programs will interpret certain strings in a special way. On the other hand, prepending the dot-slash should work for any program or argument passing style.
- just6979 1y agoPrepend for all paths on a command line? Or just for the executable? For all paths it could be dangerous and should very probably not be done. But for executables it's less dangerous and can easily be done by putting '.' into $PATH.