mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 02:55:55 +02:00
Neues Wrapper-Script fuer multiple Redirectors im Squid. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@672 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
23 lines
722 B
Bash
23 lines
722 B
Bash
#!/bin/sh
|
|
#
|
|
# This script reads in variables from a config file, and produces a list of
|
|
# commands to run to set these as shell environment variables, it is
|
|
# intended to be used as follows:
|
|
#
|
|
# eval $(readhash /var/ipfire/main/settings)
|
|
#
|
|
|
|
# shell variables must consist of alphanumeric characters and underscores,
|
|
# and begin with an alphabetic character or underscore.
|
|
VARNAME='[A-Za-z_][A-zA-z0-9_]*'
|
|
|
|
# For the assigned value we only accept a limited number of characters - none
|
|
# of which are shell metachars
|
|
VARCHARS='A-Za-z0-9=/,._@#+-'
|
|
VARVAL="[${VARCHARS}]*"
|
|
|
|
sed -ne "s/\(${VARNAME}\)=\(${VARVAL}\)$/\1=\2/p" $1
|
|
|
|
# Accept space only if it's quoted
|
|
sed -ne "s/\(${VARNAME}\)=\('[ ${VARCHARS}]*'\)$/\1=\2/p" $1
|