4 ms·
Weird that it doesn't seem to support basename (1) and dirname (1) and their Windows equivalents (e.g. %~dp0%) Quite a few of my scripts need to find files rel
by Someone 11y ago
Weird that it doesn't seem to support basename (1) and dirname (1) and their Windows equivalents (e.g. %~dp0%)
Quite a few of my scripts need to find files relative to the location of the script, or compute the path to an output file by replacing the extension of an input file.
- RGamma 11y agoAs I read it, it is mainly a language that intends to "unify" bash and batch, but basename(1) is not so much a part of bash, but of POSIX, that is an executable in a POSIX environment, that can be called via bash. However it does say "Batsh provided some "built-in" functions that will compile to platform-dependent code.". Arguably you could count basename and dirname under that.
- kevin_thibedeau 11y agoThe builtins are currently too limited. It looks like to get anything done you have to shell out to commands with call(), bash(), and batch() which leaves you with nice looking control structures surrounding a whole bunch of conditional code tailored for each platform. Path manipulation is an important missing feature. Some sort of array handling and filtering/sorting also needs to be abstracted.