New 2024 POSIX Standards specify features for sh and standard shell utilities
The document itself is paywalled like all the POSIX specifications, so here are some highlights courtesy of some comments at HackerNews, especially from a-french-anon.
The document itself is paywalled like all the POSIX specifications, so here are some highlights courtesy of some comments at HackerNews, especially from a-french-anon.
This release of fish includes a number of improvements over fish 3.6.4, detailed below. Although work continues on the porting of fish internals to the Rust programming language, that work is not included in this release. fish 3.7.0 and any future releases in the 3.7 series remain C++ programs.
git log 3.6.1..Integration_3.7.0 by searching for gitInt.↑ and then later decide to switch to the full pager.kj to switching modes in vi mode possible.fish_sequence_key_delay_ms variable (#7401), and may be set by default in future versions.
https://github.com/fish-shell/fish-shell/releases/tag/3.7.0Open linkView original on programming.devCheck out the newest version of everyone's favorite^[citation needed] command line json processing tool!
Highlights include significant speed improvements (>10x on some of my workloads), new flags, new builtins, and a litany of bugfixes.
https://github.com/jqlang/jq/releases/tag/jq-1.7Open linkView original on programming.devI'm sure some of you have absolute monstrosities of sigils (I know I do, in my .zshrc alone). Post them without context, and try and guess what other users's lines are. If you want to provide context or guess, use the markdown editor to spoiler-tag your guesses and explanations!
This came out of playing around with curl and the Lemmy API. I wanted a repeatable way to declare a bunch of shell parameters from a json object, so I wrote a jq module! Take a look at the README for examples, or once you install, run
source <( curl 'https://programming.dev/api/v3/community?id=267' | jq -r 'import "shell" as shell; .community_view | shell::param' )
Currently this project only provides a param function, and only supports Bash and Zsh. If I think of other useful helper functions, I may add them to the project.
This uses _ as a default prefix for each parameter. This is so things like {"PATH": "..."} generate typeset _PATH='...' and don't mangle your $PATH, for example. The prefix can be customized by passing in a string: param("mypfx").
Before declaring a 1.0, I'm planning on expanding shell support, and have the function determine how to output using the the $SHELL parameter:
# This does not work (yet!)
eval (curl $URL | jq -r '
import "shell" as shell;
"fish" as $SHELL |
.community_view | param
')
Always up for feedback!
https://github.com/xPMo/jq-shellOpen linkView original on programming.devYSH, or the shell formally known as oil, is touted as a possible upgrade path from Bash.
This is the first in a three-part series of posts re-introducing the language.
YSH, or the shell formally known as oil, is touted as a possible upgrade path from Bash.
This is the first in a three-part series of posts re-introducing the language.
A huge part of programming in general is learning how to troubleshoot something, not just having someone else fix it for you. One of the basic ways to do that is by tracing. Not only can this help you figure out what your script is doing and how it's doing it, but in the event that you need help from another person, posting the output can be beneficial to the person attempting to help.
(If your shell isn't listed and you know how to enable tracing, comment below and I'll add it to the table!)
| Shell | How to enable tracing |
|---|---|
| Bash | set -x or set -o xtrace |
| Fish | set fish_trace on |
| sh | set -x |
| Zsh | set -x or setopt xtrace |
Also, writing scripts in an IDE that supports your language. syntax highlighting can immediately tell you that you're doing something wrong.
If an IDE isn't an option and you're using Bash or Sh, you can paste your script into https://www.shellcheck.net/
(Inspired by this post on /r/bash)
Feedback is still welcome, either here or as Merge Requests to my Gitlab Pages repo.
https://xpmo.gitlab.io/post/intermediate-sed-usage/Open linkView original on programming.dev