0

File: camera.conf

CONFIGPATH=/system/sdcard/config
BINPATH=/system/sdcard/bin
SDPATH=/system/sdcard
PATH="/system/bin:/bin:/usr/bin:/sbin:/usr/sbin:/media/mmcblk0p2/data/bin:/media/mmcblk0p2/data/sbin:/media/mmcblk0p2/data/usr/bin"
VERSION="v0.0.5 Beta"
CONFIG_GLOBAL_VOLUME=100
CONFIG_GLOBAL_OSD_POSITION="DOWN"
CONFIG_GLOBAL_OSD_VALUE="[ Cam 1 ]  [ Dafang ]  [ %Y - %m - %d   %H : %M : %S  %Z %z  ]"
CONFIG_GLOBAL_ACCESS_USER=-1
CONFIG_GLOBAL_ACCESS_PASS=-1
CONFIG_GLOBAL_IR=0
CONFIG_GLOBAL_IR_CUT=0
CONFIG_GLOBAL_RENDER_BW=-1
CONFIG_LDR_AVG=1
CONFIG_GLOBAL_SPEAKER_GAIN=500
CONFIG_ACCESS_API=-1
CONFIG_STREAM_WIDTH=1920
CONFIG_STREAM_HEIGHT=1080
CONFIG_STREAM_NIGHTMODE=2
CONFIG_STREAM_FLIP=0
CONFIG_STREAM_ACCESS_USER="PASS"
CONFIG_STREAM_ACCESS_PASS="PASS"
CONFIG_SNAPHOT_WIDTH=1920
CONFIG_SNAPHOT_HEIGHT=1080
CONFIG_SNAPHOT_NIGHTMODE=2
CONFIG_SNAPHOT_FLIP=0
CONFIG_MOTOR_NS=100

Use sample first command and return

~$ export $(cat /system/sdcard/config/camera.conf | grep -v ^# | grep -v '^[[:space:]]*$' | sed ':a;N;$!ba;s/\n/ /g')
-sh: export: Beta": bad variable name

When Use sample second command and return

export $(cat /system/sdcard/config/camera.conf | grep -v ^# | grep -v '^[[:space:]]*$' | xargs)
-sh: export: 1: bad variable name

When Use sample third command and return

export $(cat /system/sdcard/config/camera.conf | grep -v ^# | grep -v '^[[:space:]]*$' | awk '{printf "%s ",$0} END {print ""}')
-sh: export: Beta": bad variable name

What export var with space in "" characters? Example var: VERSION="v0.0.5 Beta"

  • You export variables, not values. – Ignacio Vazquez-Abrams Feb 27 '18 at 23:03
  • What export var with values? – Krzysztof Szeremeta Feb 27 '18 at 23:07
  • Run `set -a; source yourfile; set +a`. Give me a minute, and I'll find a duplicate to close this against. – Charles Duffy Feb 27 '18 at 23:19
  • How export var without using source (set -a; source yourfile; set +a)? When export manual "with space" works. Why this command not work propely?`export $(cat /system/sdcard/config/camera.conf | grep -v ^# | grep -v '^[[:space:]]*$' | sed ':a;N;$!ba;s/\n/ /g')` – Krzysztof Szeremeta Feb 27 '18 at 23:36
  • @CharlesDuffy When I use your solution, I receive /system/sdcard/scripts/update-configuration.sh: set: line 16: illegal option -o allexport; I use this command in sh script: set -o allexport; source /run/camera.conf; set +o allexport – Krzysztof Szeremeta Feb 28 '18 at 18:49
  • @KrzysztofSzeremeta, I explicitly specified `set -a`, not `set -o allexport`. Also, with `/bin/sh`, you need to use `. yourfile`, not `source yourfile`. See my comment to that effect on an answer to the linked duplicate [here](https://stackoverflow.com/questions/19331497/set-environment-variables-from-file#comment85044296_30969768). – Charles Duffy Feb 28 '18 at 18:50
  • @KrzysztofSzeremeta, that said, you specified `bash`, not `sh`, in the tagging for this question. In the future, be sure to tag for the shell you're actually using. – Charles Duffy Mar 01 '18 at 01:20

0 Answers0