using armbian variables in a script


Recommended Posts

Donate and support the project!

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 :(

Link to post
Share on other sites

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

 

Link to post
Share on other sites

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

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...