« first day (2685 days earlier)      last day (2567 days later) » 

00:36
@FaheemMitha You can and they wont take it back now. I tried to modify it to work lol
@Jesse_b Bummer.
 
3 hours later…
03:46
does anyone know where I can find documentation on shell tests?
duh nvm sorry I was looking at the old shell manual and there is a link at the top to the new one -.-
I think it's wrong though. It says this:
-n string
True if the length of string is non-zero; otherwise, false.
-z string
True if the length of string string is zero; otherwise, false.
but I don't think they are valid shell tests
Why don't you think that?
test -n will always evaluate to true I believe
regardless of whether there is a string after it
-z seems to work though
What is the basis of that belief?
I can't find an implementation that does that
$ unset var
$ test -n $var && echo true
true
$ [ -n ] && echo true
true
now it is valid with the bash test sure
test -x returns true for every x
03:57
yes
Because it's not an operator expression
so how does -n work then?
how does it test for a zero length string
It's just an admittedly confusing application of test "$x" is-this-null
You give it a string to look at and it will
what is a zero length string other than nothing?
Compare test -n and test -n ""
@Jesse_b An absent argument is not the same as an empty argument
04:00
@MichaelHomer not quoting my variables >.> thanks
shame on me lol
With two arguments to test: "If $1 is a unary primary, exit true if the unary test is true, false if the unary test is false."
With one argument to test: "Exit true (0) if $1 is not null; otherwise, exit false."
Arguably it'd be nice if it didn't work that way, but making [ "$x" ] work for any x is important
Yea I almost always use bash tests, I'm writing up a demo on the different tests (over my head) so I wanted to show the differences between them
Thanks though I get what I was doing wrong :-)
 
1 hour later…
05:28
I fully edited and narrowed my question, Please consider open it
0
Q: A Nix utility to email myself if my site is down

user9303970I use Ubuntu 16.04 with Nginx and a few WordPress sites. Sometimes I don't visit a site for a long time (>=1 month) and it might be that the site is down. I'm looking for a small Nix utility that will email my Gmail account, if one of my Nginx-WordPress sites is down (without mentioning a reason...

06:02
Experienced with network monitoring tools? Which will you say is the simplest from these? Cacti, Check MK, Icinga, Nagios, NeDi, OpenNMS, Shinken, Vigilo NMS, Zabbix
 
2 hours later…
08:07
Simplest == could inform me if a site is down and beside that, will have as few components as possible.
 
5 hours later…
13:05
@JeffSchaller (related to your answer on that cat question) I was asked to debug what I presume must be a very old shell script today. It had things like if [ "``set -f; $echo $variable | sed 'sedscript'``" ]; then in it (yes, $echo was set to /usr/bin/echo, /bin/echo or just echo depending on which it found first). Presumably, it was written on a system where echo possibly even included the quotes in "$variable" in its output (original Bourne shell?).
(double backtick should be single backticks above. I never get the markup right with those)
13:24
@user9303970 as an aside from me, if you're not asking about NixOS, I would suggest using "nix or, since you're on the U&L site, dropping "Nix" altogether.
sigh asterisks are special. *nix maybe?
there we go.
@Kusalananda did the markup eat the quotes around $variable, or did you mean that $variable might contain double-quotes? I lost the train of the thought in the question, sorry
13:52
@JeffSchaller No, the script used set -f inside a command substitution to be able to echo the value of a variable without quoting it, to sed for modification. Today we can use built-in and standard parameter substitutions for things like that.
I was debugging this code as I saw that answer from you, that's all.
@Kusalananda ahhhh, yes. Thanks for spelling it out; the caffeine clearly hasn't taken hold of me yet. It is not often that you see set -f, although I suppose it's encouraging to see someone trying to be careful.
 
1 hour later…
15:18
@JeffSchaller, great minds etc. :P
@ilkkachu I saw other answers popping up, and kept checking to see who might be tackling the bigger problem of parsing ls ... guess I wasted too much time refreshing :) Well done!
shoot, and I didn't quote my variables! (ninja edit)

« first day (2685 days earlier)      last day (2567 days later) »