functions: renommage fonction

localeval: more robust hostname handling
This commit is contained in:
2021-02-22 11:02:14 +01:00
parent bb26868607
commit 9921222131
2 changed files with 22 additions and 20 deletions

View File

@@ -1,16 +1,18 @@
#! /bin/bash
set -euo pipefail
IFS=$'\n\t'
source functions.sh
# check that alias has been tried
echo -ne "host\tname\troot history\tbash history\t<+CHANGEME+>\n"
for host in /srv/lxc/epsi/<+CHANGEME+>/* ; do
root=${host}/rootfs
host=$(basename $host)
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network | cut -f2 -d=)
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | sed 's/\n//')\t"
echo -ne "${hostname}\t${user}"
fileMTime ${root}/root/.bash_history
fileMTime ${root}/home/formation/.bash_history
<+CHANGEME+>
echo
echo -ne "host\tname\troot history\tbash history\t<+CHANGEME+>\n"
for host in /srv/lxc/ipi/ipi_g1*/rootfs ; do
root=${host}
#host=$(basename $host)
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network | cut -f2 -d=)
test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname)
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | sed 's/\n//')\t"
echo -ne "${hostname}\t${user}"
fileMTime ${root}/root/.bash_history
fileMTime ${root}/home/formation/.bash_history
echo
done