wollik Posted July 22, 2020 Posted July 22, 2020 Hi forum members, on my interactive bash I can use the armbian variables like BOARD , BOARD_NAME or BOARDFAMILY, but these variables ard not seen when I try to use them in a bash script. Any hints ?
guidol Posted July 22, 2020 Posted July 22, 2020 there must be a difference between $BOARD and $TERM or $PWD because in a script it works for $TERM and $PWD I tought when it is a "gobal" variabel which was exported via export= it should work, but I also got this problem today with a script while trying to set a global environment variable My variable is only useable in the script and wehen it ends it isnt global anymore Havent also found the "magic searchword" today
lanefu Posted July 23, 2020 Posted July 23, 2020 in case this example helps lane@hambone:~$ cat /etc/armbian-release # PLEASE DO NOT EDIT THIS FILE BOARD=orangepi3 BOARD_NAME="Orange Pi 3" BOARDFAMILY=sun50iw6 BUILD_REPOSITORY_URL=https://github.com/armbian/rkbin BUILD_REPOSITORY_COMMIT=3e533c9 DISTRIBUTION_CODENAME=bionic DISTRIBUTION_STATUS=supported VERSION=20.05.0-trunk.038 LINUXFAMILY=sunxi64 BRANCH=current ARCH=arm64 IMAGE_TYPE=nightly BOARD_TYPE=conf INITRD_ARCH=arm64 KERNEL_IMAGE_TYPE=Image lane@hambone:~$ source /etc/armbian-release lane@hambone:~$ echo "${BOARD_NAME} ${LINUXFAMILY}" Orange Pi 3 sunxi64
guidol Posted July 23, 2020 Posted July 23, 2020 I thought it will work without a file Ok with a source-file my script-idea of a startrek-lightline for lcd4linux is working now with the following bash script (which is used by lcd4linux): #!/bin/bash -e lightfile="/var/lightactual.val" if [ -f "$lightfile" ]; then # found - do nothing sleep 0 else echo 'lightactual=0' > $lightfile fi source $lightfile # echo 'val of lightactual='$lightactual lightline[0]='---------##---------' lightline[1]='--------#--#--------' lightline[2]='-------#----#-------' lightline[3]='------#------#------' lightline[4]='-----#--------#-----' lightline[5]='----#----------#----' lightline[6]='---#------------#---' lightline[7]='--#--------------#--' lightline[8]='-#----------------#-' lightline[9]='#------------------#' echo ${lightline[$lightactual]} lightactual=$((lightactual+1)) if [ $lightactual -eq 10 ] then lightactual=0 fi echo 'lightactual='$lightactual > $lightfile # echo "lightactual after count-up="$lightactual
xwiggen Posted July 23, 2020 Posted July 23, 2020 The BOARD etc variables are imported in /etc/profile.d/armbian-check-first-login.sh, which in turn is only loaded in interactive login shells.
wollik Posted July 23, 2020 Author Posted July 23, 2020 Hi xwiggen, T H A N K S ! Using the source command in my script fixed my issues. Regards Wolfgang
Recommended Posts