]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/nb.sh
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 12 Dec 2017 23:45:00 +0000 (23:45 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 12 Dec 2017 23:45:00 +0000 (23:45 +0000)
etc/profile.d/nb.sh
etc/profile.d/sys.sh

index 4dd598c98f2e2b4f10c2c00a643f1f1cfa0c828d..9e0d89a4132803c86f145fa0ada12d8013ad1246 100644 (file)
@@ -91,9 +91,9 @@ nb_api_post() {
 }
 
 nb_post_sys_infos() {
-(
-  sys_infos | while IFS=$'\t' read -r key val; do
-    nb_api_post host_info "key=$key" "val=$val"
+  (
+  sys_infos | sed -e 's/"/\\"/g' -e 's/^/key="sys./' -e 's/\t/" val="/' -e 's/$/"/' | while read -r i; do
+    eval nb_api_post host_info $i
   done
-) | sed 's/^/nb_post_sys_infos: /'
+  )
 }
index c24908be48ad571539f4f659d57ac16d091b8606..9932943427161e1e12b4bfbe52c6a1895fe71b29 100644 (file)
@@ -4,12 +4,11 @@
 # NB 10.12.16 esac
 
 sys_infos() {
-       local n='>/dev/null 2>&1'
-       local s=$'\t'
+       local s="$(printf '\t')"
        cat <<EOF
 arch${s}$( (arch || sysctl -n hw.machine) 2>/dev/null )
 nproc${s}$( (nproc || sysctl -n hw.ncpu || grep ^proc /proc/cpuinfo | wc -l) 2>/dev/null )
-date_install $( (date -r $(ls -1drt /lost+found /etc/ssh/ssh_host_dsa_key.pub /etc/ssh_host_dsa_key.pub|head -1) +'%F %T') 2>/dev/null )
+date_install${s}$( (date -r $(ls -1drt /lost+found /etc/ssh/ssh_host_dsa_key.pub /etc/ssh_host_dsa_key.pub|head -1) +'%F %T') 2>/dev/null )
 EOF
 }