bash-core
nsd
Our great sponsors
bash-core | nsd | |
---|---|---|
2 | 8 | |
3 | 4 | |
- | - | |
3.2 | 4.7 | |
7 months ago | 4 months ago | |
Shell | ||
Mozilla Public License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
bash-core
-
I'd like your opinion on my choice of Bash for data manipulation/cleaning and some stats
Error handling is also atrocious. Doing set -e fixes some issues, but there are plenty of valid cases in which one of your commands will have an error, and your script will continue execution like nothing ever happened. And, in the case of an error, as I'm sure you have realized, diagnostics are absolutely terrible. You're extremely lucky to get a line number (which I think was only added since Bash 5.1), but that's it. If you want anything more, like a stacktrace, you're stuck in the water. I have developed a library, bash-core, to help with this, but the stacktrace handling acts unexpectedly if there are errors within subshells.
-
Bash functions are better than I thought
I'm quite happy to see that something Bash-related is on Hacker News! Unfortunately it seems that I don't really agree with much the author...
While I do agree that it would be nice to be able to have 'local' functions and have inter-function cleanup work better, the logical conclusion for me was not to use function subshells. Since the use case is for larger programs (where different functions may want to have their own cleanup mechanisms), I'm opting to go for more of a library route. For example, I'm working on a Bash library that includes a function to allow different sources to add (and remove) functions to the same `TRAP`. A similar function may be useful, possibly involving the `RETURN` trap and the `-T` flag. Obviously, using a package manager for _Bash_ of all languages brings in a lot of overhead, but I think it can be quite powerful, especially with a potential "Bundle" feature that makes scripts work without the package manager.
Concerning specifically the use of subshells, (as other commenters have pointed out) it significantly reduces performance. I also disagree that dynamic scoping is necessarily bad for Bash. I find it quite useful when I need to use various common functions to manipulate a variable - since modifying and 'returning' variables from a function is usually either slow or verbose with Bash. Admittedly though, this feature is quite annoying at times - for example, most public functions in my Bash package manager[2] all have their variables prefixed with two underscores - because they `source` all the shell scripts of all package dependencies - so I want to be extra certain nothing weird happens
[1] https://github.com/hyperupcall/bash-core/blob/a17ab0a8b6070f...
nsd
-
Announcing Hush, a modern shell scripting language
Repository of scripts written in the language - https://github.com/ngs-lang/nsd
-
Bash functions are better than I thought
> there isn't really an entry point in murex scripts
I have a nice trick in NGS for that. Under the idea that "small scripts should not suffer", script is running top to bottom without "entry point". However, if the script has defined main() function, it is invoked (with command line arguments passed).
Example - https://github.com/ngs-lang/nsd/blob/afe0cad5e506ec4ee2fa924...
> `args` still contains more boilerplate code than I'm happy with
Is there anything preventing you to have exactly the same functionality but with syntactic sugar that it looks like parameters declaration? (Just to be clear, keeping all the ARGV machinery).
Something like (assuming local variables are supported; if not, it could still be $args[Flags] etc):
function hippo(name:str, hungry:bool) {
-
I love jq, I hate jq. Help a competent grepper get a grasp on the terse language!
NGS Scripts Dumpster - collection of small scripts in NGS
- GitHub – nushell/nushell: A new type of shell
-
No, you can't do it better in Python or bash (challenge)
Doing DevOps today? 99% either abuse bash or abuse a general purpose programming language.
bash does not meet any modern expectations from a programming language: syntax, error handling, data structures
General purpose languages such as Python, Ruby, etc are not domain specific enough to have the desired facilities.
Here is small example of straightforward solution to a small problem: list all CloudFormation stacks that are managed by the given CodePipeline.
https://github.com/ngs-lang/nsd/blob/02d66abb844b7dd6077b9976e3a03659cf4b3660/aws/codepipeline/pipeline-stacks.ngs
- Which CloudFormation stacks are managed by a CodePipeline - script
-
Delete CloudFormation Stack Including S3 Objects
The script is at https://github.com/ngs-lang/nsd/blob/master/aws/cloudformation/delete-stack.ngs
- What is your favorite shell and why
What are some alternatives?
bash-object - Manipulate heterogenous data hierarchies in Bash.
ngs - Next Generation Shell (NGS)
hasura-ci-cd-action
oh - A new Unix shell.
bash2048 - 2048 in bash
fx - Terminal JSON viewer & processor
lsofer - script to match similar functionality to lsof -i, and then some.
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
basalt - The rock-solid Bash package manager.
nushell - A new type of shell
Seed - A Rust framework for creating web apps