3 ms·
Bash is a shell. A bad shell. Korn is a good shell. It's not meant to be a real language. It's meant to be a shell. Here, let me back that up and reverse it
by usernew 3y ago
Bash is a shell. A bad shell. Korn is a good shell.
It's not meant to be a real language. It's meant to be a shell. Here, let me back that up and reverse it for you.
<JAVA>
public Set<String> listFilesUsingJavaIO(String dir) {
return Stream.of(new File(dir).listFiles())
.filter(file -> !file.isDirectory())
.map(File::getName)
.collect(Collectors.toSet());
} //I'm not handling errors, and this doesn't actually print anything, it just lets me try to.
<SHELL>
ls
Shell is meant to be a common way to do common tasks on commandline, and make a little script if you want to save that and run it again. I can do little things in a shell one-liner quick, that would take a page of python or perl.
I put up with my sports car because there's no better alternative. It doesn't mean I should put up with a sports car for transporting my piano, just that I must put up with it at least to the point where the sports car can transport me to the car that transports a piano.
- SomeCallMeTim 3y agoBash is used as a programming language. And it's an objectively awful programming language. Sh is even worse. Korn isn't installed absolutely everywhere like Sh is. It's not even installed in 1/100 of the locations that Bash is installed. So it being better is irrelevant to the discussion of Bash as a programming language. Because Bash is so awful, the only real justification for using it as a programming language is that it's already installed. Since Korn isn't already installed, that means you'd need to install it. If you're going to be installing something, there are far better choices. So your comment doesn't at all contribute to the discussion of alternatives to using Bash as a programming language. And the verbosity of using Java to list a folder contents is equally irrelevant. No one would argue that Java is better ... for listing directory contents. If you do want to write a script that calls a bunch of shell commands, or even that operates on folders and files, there are far better languages and tools. See, for example, https://www.npmjs.com/package/tish https://www.npmjs.com/package/tish Or just Node/TypeScript in general.