Revision 1973
Added by Aaron Marcuse-Kubitza almost 13 years ago
bin/vegbien_dest | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
# Requires var bien_password |
3 | 3 |
|
4 |
: ${prefix=out_} |
|
5 |
export ${prefix}engine=PostgreSQL ${prefix}host=localhost ${prefix}user=bien \ |
|
6 |
${prefix}password="$bien_password" ${prefix}database=vegbien |
|
4 |
vegbien_dest_main () |
|
5 |
{ |
|
6 |
local self="${BASH_SOURCE[0]}" |
|
7 |
local selfDir="$(dirname -- "$self")" |
|
8 |
|
|
9 |
if test "${BASH_LINENO[1]}" = 0; then # was run without initial "." |
|
10 |
echo "Usage: . $self (note initial \".\")"|fold -s >&2 |
|
11 |
return 2 |
|
12 |
fi |
|
13 |
|
|
14 |
: ${prefix=out_} |
|
15 |
|
|
16 |
export \ |
|
17 |
${prefix}engine=PostgreSQL \ |
|
18 |
${prefix}host=localhost \ |
|
19 |
${prefix}user=bien \ |
|
20 |
${prefix}password="$(cat "$selfDir/../config/bien_password")" \ |
|
21 |
${prefix}database=vegbien |
|
22 |
} |
|
23 |
vegbien_dest_main "$@" |
Also available in: Unified diff
vegbien_dest: Get bien_password by searching relative to $self, which we now have a way to get in a bash script (${BASH_SOURCE0}), rather than requiring the caller to set it. Provide usage error if run without initial ".".