TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Bash 5.0 released

534 点作者 siteshwar超过 6 年前

14 条评论

_kst_超过 6 年前
With this release, bash now has three built-in variables (um, I mean &quot;parameters&quot;) whose values are updated every time they&#x27;re read:<p>$RANDOM yields a random integer in the range 0..32767. (This feature was already there.)<p>$EPOCHSECONDS yields the whole number of seconds since the epoch.<p>$EPOCHREALTIME yields the number of seconds since the epoch with microsecond precision.<p>I&#x27;m thinking of a new shell feature that would allow the user to define similar variables. For example, I have $today set to the current date in YYYY-MM-DD format, and I have to jump through some minor hoops to keep it up to date.<p>Does anyone else think this would be useful enough to propose as a new bash feature? Would it create any potential security holes? Should variables like $PATH be exempted?<p>(Of course this doesn&#x27;t add any new functionality, since I could use &quot;$(date +%F)&quot; in place of &quot;$today&quot;. It&#x27;s just a bit of syntactic sugar.)
评论 #18854110 未加载
评论 #18853669 未加载
评论 #18853545 未加载
评论 #18854749 未加载
评论 #18853516 未加载
评论 #18853668 未加载
评论 #18853972 未加载
评论 #18854300 未加载
评论 #18853497 未加载
评论 #18853486 未加载
评论 #18853997 未加载
wlib超过 6 年前
Why did we keep the language of the shell and the OS separate? It seems like a needless abstraction which creates more harm than good (read a shell script vs any other language). While I&#x27;m at it, why is the filesystem and syscall api not just part of a standard userland language? For example, the filesystem could be exposed like an object tree rather than some syscall ritual. The syscalls could just be invisible, where the language compiler deals with it instead of the programmer. I think that the old LISP machines got this right while we are stuck in a usless POSIX compatibility trap. The only reason I think they didn&#x27;t design unix this way was because C was too low level, but we could write the OS in a &quot;higher level&quot; functional language.
评论 #18854172 未加载
评论 #18853169 未加载
评论 #18852861 未加载
评论 #18852999 未加载
评论 #18852915 未加载
评论 #18854791 未加载
评论 #18853084 未加载
评论 #18855211 未加载
评论 #18852773 未加载
wicket超过 6 年前
Seeing this release makes me cringe. I&#x27;ve used Bash as an interactive shell for decades but really I&#x27;m sick and tired of it.<p>As a scripting language, I loathe it and really don&#x27;t understand its purpose. I always write shell scripts in POSIX shell for portability reasons. Most of the time I don&#x27;t need to use any of Bash&#x27;s features. In cases where advanced features are needed and portability is not a concern, there are other scripting languages much better suited for this (Python, Ruby, etc).<p>As an interactive shell, the only features I ever use are command history and tab completion. Bash is way too bloated for my use case (it&#x27;s only a matter of time before the next Shellshock is discovered). Other lightweight shells are missing the couple of interactive features which I do use.<p>If anyone knows of a shell which meets my criteria of being lightweight but with command history and tab completion (paths, command names and command arguments), I&#x27;d really appreciate any suggestions. Otherwise I may have to look into extending dash or something.
评论 #18857469 未加载
评论 #18855708 未加载
评论 #18856599 未加载
评论 #18857504 未加载
评论 #18856246 未加载
评论 #18857304 未加载
评论 #18856821 未加载
评论 #18855662 未加载
评论 #18859650 未加载
评论 #18857575 未加载
评论 #18855815 未加载
offmycloud超过 6 年前
It&#x27;s sad that lists.gnu.org is running obsolete TLS 1.0 crypto with weak 1024-bit DH. Either upgrade to TLS 1.2 with reasonable cipher suites, or just go back to plain HTTP.
评论 #18856558 未加载
BurritoAlPastor超过 6 年前
I can’t imagine what BASH_ARGV0 is for. Can someone more sage supply an example of what problem it solves?
评论 #18852945 未加载
评论 #18852846 未加载
评论 #18852854 未加载
评论 #18855649 未加载
giancarlostoro超过 6 年前
Any recommended reading for Bash? I&#x27;m somewhat new to it and it&#x27;s interesting ways of getting things done. I&#x27;ve used it minimally in the past, but have found myself writing a 100&gt; LOC script, which I can&#x27;t help but feel I&#x27;m likely over-complicating certain bits and pieces.
评论 #18852744 未加载
评论 #18854245 未加载
评论 #18852641 未加载
评论 #18852752 未加载
评论 #18852687 未加载
评论 #18852635 未加载
评论 #18854565 未加载
评论 #18853158 未加载
评论 #18853162 未加载
评论 #18852642 未加载
评论 #18852704 未加载
评论 #18853126 未加载
评论 #18852639 未加载
评论 #18854073 未加载
评论 #18852837 未加载
评论 #18852767 未加载
评论 #18853663 未加载
评论 #18852676 未加载
评论 #18853611 未加载
nerdponx超过 6 年前
What is the value in creating built-in replacements for binaries like rm and stat?
评论 #18853854 未加载
评论 #18853132 未加载
评论 #18853117 未加载
评论 #18853142 未加载
评论 #18853141 未加载
timvisee超过 6 年前
Yet macOS is still on 3.2.
评论 #18854396 未加载
评论 #18854390 未加载
评论 #18855642 未加载
ris超过 6 年前
&gt; The `history` builtin ... understands negative arguments as offsets from the end of the history list<p>At last!
nurettin超过 6 年前
BASH_ARGV0 &lt; does that mean we can set process title after the script starts?
评论 #18854338 未加载
sabujp超过 6 年前
how about a good way to pass around associative arrays and arrays
pornel超过 6 年前
Reminder that 2019 version of macOS ships with 2007 (last GPL2) version of Bash, and will never ship with any newer version.<p><pre><code> &#x2F;bin&#x2F;bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) Copyright (C) 2007 Free Software Foundation, Inc. </code></pre> macOS used to be an awesome developer machine with good tools out of the box. Now the built-in tools are just a bootstrap for their own replacement via Homebrew. Like IE for downloading Chrome.
评论 #18852920 未加载
评论 #18852938 未加载
评论 #18853466 未加载
评论 #18853021 未加载
评论 #18852962 未加载
评论 #18853376 未加载
评论 #18853136 未加载
sirjaz超过 6 年前
I know I may be downvoted&#x2F;flamed on this, but why doesn&#x27;t everyone start looking at powershell as the default shell. All the default parameters you are looking for are already there. Plus, you can you use all the other standard shell tools
fxfan超过 6 年前
As someone who lives in zsh and bash for interactive usage- I want to say- please do not write scripts in bash or zsh. Use powershell- its an amazingly well designed scripting language.<p>Also- there is ammonite. Written for scripting.
评论 #18853680 未加载
评论 #18853073 未加载
评论 #18853529 未加载
评论 #18854969 未加载
评论 #18854714 未加载