This is the table from man 5 terminfo.
Do NOT hardcode terminal escape sequences. Use tput with the cap-names from the table below to get the right code for your terminal.
| (P) | indicates that padding may be specified |
| s|8|.7|g;s|7|.6|g;s|6|.5|g;s|5|.4|g;s|4|.3|g;s|3|.2|g;s|2|.1|g;s|1|.|g;s|.| &|g;s|/|\n|g |
| #!/bin/bash | |
| owner=izabera nick=sedirc network=irc.freenode.net | |
| echo " | |
| # send bot data | |
| 1 { | |
| s/.*/nick $nick/p | |
| s/.*/user $nick $nick $nick :$nick/p | |
| s/.*/cat factoids 2>\/dev\/null/e; H | |
| b |
This is the table from man 5 terminfo.
Do NOT hardcode terminal escape sequences. Use tput with the cap-names from the table below to get the right code for your terminal.
| (P) | indicates that padding may be specified |
This is from man bash:
A pipeline is a sequence of one or more commands separated by one of the control operators | or |&. The format for a pipeline is:
[ time [ -p ]] [ ! ] command [ [ | | |& ] command2 ... ]
This is the only place in which ! can appear. It never prefixes commands, it prefixes pipelines.
for the latest chapter of what's becoming a blog on the most cursed bash you can imagine, let's do some maths together
euclid's algorithm for gcd could be written like this in python:
>>> def gcd(a, b):
... if b:
... return gcd(b, a%b)
... return ai'm writing another lil cube thing. if you've ever written a rubik's cube simulator/solver, you will know that some parts can be more akin to data than to code. one way or another, you always end up with lots and lots of tables to select the right pieces and move them to the right places. if good code reads like poetry and bad code reads like a phonebook, this is always easily in the top 10 most mind-numbingly boring programs of all time.
i needed to share a single file so i wrote a quick webserver in bash like any normal person would. it supports head and get, which was all i needed. as far as i'm aware it doesn't misbehave too badly
then i showed it to a bunch of extremely smart phd level agi bots that are going to replace us all and asked them to review it and point out any flaws
namerefs (introduced in bash 4.0) act as aliases for other variables
var=meow
declare -n ref=var
echo $ref # prints meow
ref=moo
echo $var # prints moo