[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*
By Anonymous, 2015-07-22 14:51:27
17 *	* * *	root	[[ $(ping -c1 8.8.8.8 | tail -n2 | head -n1 | cut -d"," -f2 | cut -d" " -f2) != "1" ]] && { { /etc/init.d/networking restart && /etc/init.d/network-manager restart && curl "https://api.telegram.org/XXX:XXX/sendMessage?chat_id=XXX&text=\%22networking\%20and\%20network-manager\%20restarted\%22" ;} && { wget -O /dev/null -o /dev/null https://nyifiles.pfsense.org/mirror/downloads/pfSense-CE-2.3.5-RELEASE-2g-i386-nanobsd.img.gz && curl "https://api.telegram.org/XXX:XXX/sendMessage?chat_id=XXX&text=\%22wget\%20download\%20OK\%22" || curl "https://api.telegram.org/XXX:XXX/sendMessage?chat_id=XXX&text=\%22wget\%20download\%20KO\%22" ;} ;}

With me! Sing! It's gonna ping! If not it's gonna restart the net! If yes is gonna send you a text! And then is gonna download a file, just to check!

By AnonimaBazhi, 2018-12-04 19:33:23
sed -i 's/^#HTTPD=\/usr\/sbin\/httpd.worker/HTTPD=/\/usr\/sbin\/httpd.worker/g' /etc/sysconfig/httpd 
By Anonymous, 2017-12-13 18:09:51
cd /some/directory
rm -rf *

I regularly see these two lines in Bash scripts I don't understand but some programmers think you need a CD command before any command, and they also don't know that paths can be part of parameters (which explains why they use many CD commands)

By Meeeeee, 2023-01-25 16:50:10
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )";

export KUBECONFIG="${DIR}/my_secret_stuff/kube.conf";

Example on how to get location of the script right

By Piotr, 2020-05-11 12:45:57
    if [ $product == "consul" ]
    then
       aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
       unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
       rm   ${product}-enterprise_${version}+prem_linux_amd64.zip
    else
       aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
       unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
       rm   ${product}-enterprise_${version}+prem_linux_amd64.zip
    fi 
By Anonymous, 2019-10-22 15:10:43
nohup find dump_events/* -type f -name "*.jpg" -exec bash -c "cp -v {} \"backup_events/\`ls {} --full-time --time-style="+%Y-%m-%d_%H-%M-%S" | cut -d ' ' -f 6 \`_\`md5sum {} | cut -d ' ' -f 1\`.jpg\";" \; & 

Let's do this... I may also add this... And this... And that... And the other thing there... Then calculate how flat the earth is... But in one line!

By Bazhmania, 2018-12-04 10:20:40