3 ms·
Thanks for the list, there are many useful examples. Another way to get the last date in current month (== the number of days in a month) is: : $(cal); ec
by kseistrup 8y ago
Thanks for the list, there are many useful examples.
Another way to get the last date in current month (== the number of days in a month) is:
: $(cal); echo $_
- lloeki 8y agoFor the curious, `:` is the noop builtin in bash. I use it mostly as I would use `pass` in python, since empty conditionals or functions are a parse error. if whatevs; then : fi
- kseistrup 8y agoAnd to elaborate even more: ‘:’ is the command, and ‘$(cal)’ – which equals the unquoted output from running the ‘cal’ command – are the arguments. The last day of the month is thus the last argument of ‘:’ and can be referenced with the ‘$_’ variable.