Controversial perhaps, but I now use Go where I used to be a prolific shell script script coder. Main reasons: - Fewer opportunities for foot-guns - Ease of portability, no dependencies, e.g. no more "is jq installed ?" - Consistent cross-platforms, e.g. no more "is this system using GNU sed ?" - Modern stuff like crypto, and "internet stuff" is just quicker and easier to do in Go.
The bash book to rule them all
11–20 of 56 posts
Re: The bash book to rule them all
#12 $ uname
Darwin
$ which cd
/usr/bin/cdRe: The bash book to rule them all
#13Controversial perhaps, but I now use Go where I used to be a prolific shell script script coder. Main reasons: - Fewer opportunities for foot-guns - Ease of portability, no dependencies, e.g. no more "is jq installed ?" - Consistent cross-platforms, e.g. no more "is this system using GNU sed ?" - Modern stuff like crypto, and "internet stuff" is just quicker and easier to do in Go.
Re: The bash book to rule them all
#14> You want to understand why cd is not an executable but a builtin? Because a sub-process cannot change the working directory of its parent. The shell process needs to change its own working directory. Therefore cd must be a builtin. Although, I suppose that one might execve a cd binary, which would change directory and then in turn the cd binary would execve the shell that is specified in the $SHELL env var. That wo…
Re: The bash book to rule them all
#15$ uname Darwin $ which cd /usr/bin/cd
What you posted is not reproducable on Ventura (13.6)
% uname
Darwin
% which cd
cd: shell built-in commandRe: The bash book to rule them all
#16Controversial perhaps, but I now use Go where I used to be a prolific shell script script coder. Main reasons: - Fewer opportunities for foot-guns - Ease of portability, no dependencies, e.g. no more "is jq installed ?" - Consistent cross-platforms, e.g. no more "is this system using GNU sed ?" - Modern stuff like crypto, and "internet stuff" is just quicker and easier to do in Go.
Even more controversial, I use Swift.
Re: The bash book to rule them all
#17Controversial perhaps, but I now use Go where I used to be a prolific shell script script coder. Main reasons: - Fewer opportunities for foot-guns - Ease of portability, no dependencies, e.g. no more "is jq installed ?" - Consistent cross-platforms, e.g. no more "is this system using GNU sed ?" - Modern stuff like crypto, and "internet stuff" is just quicker and easier to do in Go.
If Go why not something like Python though...?
With Go, you write, you compile, you ship the binary, job done.
Re: The bash book to rule them all
#18$ uname Darwin $ which cd /usr/bin/cd
Huh ? Which OS X are you on ? What you posted is not reproducable on Ventura (13.6) % uname Darwin % which cd cd: shell built-in command
(zsh has which as a built in command, apparently bash doesn't, which causes the different output). It's unclear to me what /usr/bin/cd actually accomplishes though, even in bash.
(final edit I hope, I found an explanation of sorts for /usr/bin/cd: https://unix.stackexchange.com/a/50060)
Re: The bash book to rule them all
#19Earlier quoted context omitted.
If Go why not something like Python though...?
Because Python is godawful for dependencies. With Go, you write, you compile, you ship the binary, job done.