Live data from Hacker News

Show HN: Bish – Shell scripting with a modern feel

github.com

1–10 of 44 posts

Re: Show HN: Bish – Shell scripting with a modern feel

#3
post #2

Why not fish (friendly interactive shell)?

Not the OP, but I was under the impression that fish de-emphasizes shell scripting/programming and puts more emphasis on the interactive experience.

It feels like bish is trying to make using bash as a programming language tolerable.

Re: Show HN: Bish – Shell scripting with a modern feel

#4
def printall(files) {

    for (f in files) {

        print(f);

    }
}

# cwd, ls, and cd are all builtin functions.

dir = cwd();

files = ls();

print("Files in current directory $dir:");

printall(files);

cd("/");

files = ls();

print("Files in root directory:");

printall(files);

Whats wrong with this, much shorter Bash sequence:

echo Files in current directory `pwd`:

ls

cd /

echo Files in root directory:

ls

Re: Show HN: Bish – Shell scripting with a modern feel

#5
post #4

def printall(files) { for (f in files) { print(f); } } # cwd, ls, and cd are all builtin functions. dir = cwd(); files = ls(); print("Files in current directory $dir:"); printall(files); cd("/"); files = ls(); print("Files in root directory:"); printall(files); Whats wrong with this, much shorter Bash sequence: echo Files in current directory `pwd`: ls cd / echo Files in root directory: ls

(OP here). You're right: for simple tasks like listing files or changing directories, you probably don't need bish. I should come up with some better examples where bish wins in readability.

Re: Show HN: Bish – Shell scripting with a modern feel

#6
post #3
post #2

Why not fish (friendly interactive shell)?

Not the OP, but I was under the impression that fish de-emphasizes shell scripting/programming and puts more emphasis on the interactive experience. It feels like bish is trying to make using bash as a programming language tolerable.

That's what I was going for. Not a replacement for bash the shell, but a language that provides a bit more comfort for programmers while retaining the ability to run on any system your scripts did previously.

Re: Show HN: Bish – Shell scripting with a modern feel

#7
post #4

def printall(files) { for (f in files) { print(f); } } # cwd, ls, and cd are all builtin functions. dir = cwd(); files = ls(); print("Files in current directory $dir:"); printall(files); cd("/"); files = ls(); print("Files in root directory:"); printall(files); Whats wrong with this, much shorter Bash sequence: echo Files in current directory `pwd`: ls cd / echo Files in root directory: ls

I believe the problem comes when trying to do stuff like check to see if a file is in a directory. I'm a ZSH user myself, and my default scripting language is Python for similar reasons to the OP's for inventing Bish. I can't for the life of me figure out the syntax for an if statement, especially for things like checking if files exist. Yes, Bash or Zsh have a shorter syntax for the example, but to do something like this[1] in bash/zsh would be, for me at least, needlessly difficult and painful.

[1] https://github.com/yramagicman/dotfiles/blob/master/bin/upda...

Re: Show HN: Bish – Shell scripting with a modern feel

#8
post #4

def printall(files) { for (f in files) { print(f); } } # cwd, ls, and cd are all builtin functions. dir = cwd(); files = ls(); print("Files in current directory $dir:"); printall(files); cd("/"); files = ls(); print("Files in root directory:"); printall(files); Whats wrong with this, much shorter Bash sequence: echo Files in current directory `pwd`: ls cd / echo Files in root directory: ls

[deleted]
Post reply on HN