41 Matching Annotations
- Feb 2021
-
unix.stackexchange.com unix.stackexchange.com
-
Now this probably won't make difference in the real world (e.g. because the exit codes are not portable and on top of that not always unambiguous as discussed in Default exit code when process is terminated?)
-
-
unix.stackexchange.com unix.stackexchange.com
-
In any case signal handling in shells is one of the least reliable and portable aspects. You'll find behaviours vary greatly between shells and often between different versions of a same shell. Be prepared for some serious hair pulling and head scratching if you're going to try to do anything non-trivial.
-
-
unix.stackexchange.com unix.stackexchange.com
-
The parentheses always start a subshell. What's happening is that bash detects that sleep 5 is the last command executed by that subshell, so it calls exec instead of fork+exec. The sleep command replaces the subshell in the same process.
-
-
stackoverflow.com stackoverflow.com
-
if the process does not react on a normal kill, you may want to add an additional kill -9 a few seconds afterwards.
-
-
stackoverflow.com stackoverflow.com
-
IFRAME element may be a security risk if any page on your site contains an XSS vulnerability which can be exploited
-
- Dec 2020
-
github.com github.com
-
${JSON.stringify(state)}
-
XSS mitigation
-
- Nov 2020
-
stackoverflow.com stackoverflow.com
-
Never use x && y || z when y can return a non-zero exit status.
-
-
stackoverflow.com stackoverflow.com
-
yell() { echo "$0: $*" >&2; } die() { yell "$*"; exit 111; } try() { "$@" || die "cannot $*"; }
-
If it's closing the "window" likely you're putting the exit # command inside a function, not a script. (In which case use return # instead.)
-
-
mywiki.wooledge.org mywiki.wooledge.org
-
Bash (like all Bourne shells) has a special syntax for referring to the list of positional parameters one at a time, and $* isn't it. Neither is $@. Both of those expand to the list of words in your script's parameters, not to each parameter as a separate word.
-
However, this construct is not completely equivalent to if ... fi in the general case.
The caveat/mistake here is if you treat it / think that it is equivalent to if a then b else c. That is not the case if b has any chance of failing.
-
-
-
-
The potential problem: if second_task fails, third_task will not run, and execution will continue to the next line of code - next_task, in this example. This may be exactly the behavior you want. Alternatively, you may be intending that if second_task fails, the script should immediately exit with its error code. In this case, the best choice is to use a block - i.e., curly braces: first_task && { second_task third_task } next_task Because we are using the -e option, if second_task fails, the script immediately exits.
-
When people write COND && COMMAND, typically they mean "if COND succeeds (or is boolean true), then execute COMMAND. Regardless, proceed to the next line of the script." It's a very convenient shorthand for a full "if/then/fi" clause.
-
-
stackoverflow.com stackoverflow.com
-
[[ -z "$a" || -z "$b" ]] && usage
-
-
github.com github.com
-
It starts truncating it's output (shortening strings with ...) once you pipe it's output into grep. That is quite unacceptable. When I am checking if something is inhibited in a script, I should have all possible information available and not have to consider if a string will get truncated when being piped into a tool, that is perfectly readable on a wide terminal.
-
- Oct 2020
-
unix.stackexchange.com unix.stackexchange.com
-
An even more general version that allows using find options:
"find up" command
-
- Jun 2020
-
stackoverflow.com stackoverflow.com
-
{ read foo ; read filesystem size using avail prct mountpoint ; } < <(df -k /)
-
- May 2020
-
stackoverflow.com stackoverflow.com
-
I have used this bash one-liner before set -- "${@:1:$(($#-1))}" It sets the argument list to the current argument list, less the last argument.
Analogue of
shift
built-in. Too bad there isn't just apop
built-in.
-
-
thoughtbot.com thoughtbot.com
-
docs.gimp.org docs.gimp.org
-
Scripts In addition to plug-ins, which are programs written in the C language, GIMP can also make use of scripts. The largest number of existing scripts are written in a language called Script-Fu, which is unique to GIMP (for those who care, it is a dialect of the Lisp-like language called Scheme). It is also possible to write GIMP scripts in Python or Perl. These languages are more flexible and powerful than Script-Fu; their disadvantage is that they depend on software that does not automatically come packaged with GIMP, so they are not guaranteed to work correctly in every GIMP installation.
-
- Apr 2020
-
github.com github.com
-
Invert the exit code of a process. Make 0 into 1 and everything else into a 0. An alternative to ! some-command syntax present in some shells.
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
And I continue to tell people: Friends don't let friends write bash script.
-
- Feb 2020
-
github.com github.com
-
github.com github.com
-
github.com github.com
- Dec 2019
-
-
\curl
What is the leading \ for? Is that the same as prefixing it with
command
to ensure no aliases are used?Found answer here: https://hyp.is/1lBLAiHEEeqP7Sd3rqQLxg/rvm.io/rvm/install
-
-
security.stackexchange.com security.stackexchange.com
-
As for exec, I am just using it because it makes sense to run the final command in the same process, replacing the wrapper script instead of spawning a new process. It's not strictly necessary.
-
- Nov 2019
-
github.com github.com
-
100% VimL compatibility - we may not support all features of VimL plugins / configuration.
understandable... vim script is a mess, ugly, and non-standard
-
-
devhints.io devhints.io
- Sep 2019
-
unix.stackexchange.com unix.stackexchange.com
- Feb 2017
-
content.netdevgroup.com content.netdevgroup.com
-
A shell script is a file of executable commands that has been stored in a text file. When the file is run, each command is executed.
The power of BASH!
-
- Sep 2016
-
forum.renoise.com forum.renoise.com
-
I don't know what then, I just remember somehow. Around the same time I install renoise, I also install vim. Then in renoise I go to Help>Show Preferences Folder.... Then I right click on Config.xml, then edit in VIM. Then I /search for showscr or something like that. Change false into true, done. On windows sometimes I'm lazy and I just modify the one shortcut that I use to have --scripting-terminal or something as an argument. Also: if you really do a lot of (re)installs I would advise to back up your Config.xml anyway, just like the KeyBindings.xml, TemplateSong.xrns, etc, it'll save you a lot of time right?
How to enable Scripting Tools in Renoise Tools menu
-
- Nov 2015
-
felix-lang.org felix-lang.org
-
In my opinion one of the key properties of a scripting language is not to be found in the language itself, but rather the tools that are used to deploy it. Traditionally a script in Perl or Python can just be run, without explicitly invoking a complex compilation and linkage script.
A good point, but unlike the author, I still feel that having a REPL is also important for distinction as a scripting language, as it facilitates rapid prototyping.
-