Меняем имя интерфейся en* на eth0 в CentOS 7
#!/bin/bash

HWADDR=$(cat /sys/class/net/e*/address)
echo "MAC: $HWADDR"
IFENV=$(ls -l /etc/sysconfig/network-scripts | grep ifcfg- | grep -vE 'lo|eth' | awk -F"ifcfg-" '{ print $NF }')
echo "interface name: $IFENV"
sed -i "s/rhgb quiet/rhgb quiet net.ifnames=0/" /etc/default/grub
echo "adding \"net.ifnames=0\" to grub"
grub2-mkconfig -o /boot/grub2/grub.cfg
echo "SUBSYSTEM==\"net\", ACTION=\"add\", DRIVERS==\"?*\", ATTR{address}==\"$HWADDR\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"eth0\"" > /etc/udev/rules.d/70-persistent-net.rules
echo "creating /etc/udev/rules.d/70-persistent-net.rules"
cd /etc/sysconfig/network-scripts
mv ./ifcfg-$IFENV ./ifcfg-eth0
sed -i "s/$IFENV/eth0/g" ./ifcfg-eth0
echo "renaming $IFENV to eth0"
echo -ne "\nReboot now\t [y/n]?\n"
read answer
case "$answer" in
  y|Y) shutdown -r now
      ;;
  n|N) echo "You must reboot system to apply changes"
      exit 0
      ;;
  *) echo -ne "Wrong type of answer\nPlease restart your system manualy"
      ;;
esac

Случайный пусть из двусимвольных папок
#!/bin/bash

read -a arr <<<$(date --rfc-3339=ns | sed -r "s/\s|:|-|\.|\+//g" | md5sum | awk '{ print $1 }' | perl -e '$, = " "; while ($line = ) { print (split //,  $line ); }' )
x=${#arr[@]}
z=0

while [[ $z -le $x ]]; do
echo -ne "/${arr[$z]}"
let z=z+1
echo -ne "${arr[$z]}"
done

Аналог logrotate для nginx/apache
#!/bin/bash

start=$(date)
logpath=/var/log
regexp='(?<!\d)\d{8}(?!\d)'
apps=('nginx' 'httpd')
this_log=$logpath/logmove/$(date +%Y%m%d).log

for app in ${apps[@]}; do
  if [ -d $logpath/$app ]; then
    rotate=$logpath/$app
    for j in $rotate/*.log; do
      if [ ! -f $j-$(date +%Y%m%d) ]; then
        mv $j $j-$(date +%Y%m%d)
      else
        cat $j >> j-$(date +%Y%m%d)
        cat /dev/null > $j
      fi
       [ $app == "httpd" ] && /usr/bin/sudo systemctl reload httpd || /usr/bin/sudo systemctl reload nginx
    done
    files=(${files[@]} $(find $rotate -maxdepth 1 -type f | grep -P $regexp))
  fi
done

if [ ! -z "$files" ]; then
  for i in  ${files[@]}; do
    datefile=$(echo $i | awk -F'-' '{ print $NF }')
    eval "$(echo $datefile | awk '{ print "fyear="substr($1,0,4)" fmonth="substr($1,5,2)" fday="substr($1,7,2) }')"
    appname=$(dirname "$i")
    dstpath=$logpath${appname#$logpath}
    dstfold="$dstpath/$fyear/$fmonth/$fday"
    shortname=$(basename $i | sed "s/.\{,9\}$//")
    [ ! -d $dstfold ] && mkdir -p $dstfold
    if [ -f $dstfold/$shortname ]; then
      if [ $(find $dstfold -name "${shortname}_*" | wc -l) -gt 0 ]; then
        max_file=$(find $dstfold -name "${shortname}_*" | awk '{print length, $0}' | sort -nr | head -n1)
        log_ver=${max_file: -1}
        let log_ver_up=$log_ver+1
        shortname=${shortname}_${log_ver_up}
      else
        shortname=${shortname}_1
      fi
    fi
    mv $i $dstfold/$shortname
    echo -ne "$i\t -> $dstfold/$shortname\n" >> $this_log
  done
  echo "$(basename $0) started at $start and worked $SECONDS sec." >> $this_log
fi