Comment

Comment by Y_Y

On that point, I see an awful lot of code that uses dotslash as if it was necessary for files in the current directory.

You only need to prepend dotslash to a filename in order of disambiguate invocations of executables in the the current directory (and not a subdirectory).

This is because bare commands will be looked up in $PATH, rather than among executable files in $PWD.

It strikes me as weird copycat (without understanding) programming to just have it wherever you're referring to a local file. In fact I prefer to invoke `bash foo.sh` rather than `mv foo.sh foo; chmod +x foo.sh; ./foo.sh`. (This assumes that I don't need to rely on something special in the shebang line.) This also lets you use tab-completion as normal, as well as adding flags for bash like -x.

(I know you could use it for clarity when an argument could look like a string or a file, but I don't think that's usuaully the purpose.)

parent Y_Y 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton