forked from manandakmsft/asb-spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveenv.sh
More file actions
executable file
·35 lines (28 loc) · 763 Bytes
/
saveenv.sh
File metadata and controls
executable file
·35 lines (28 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# change to the proper directory
cd $(dirname $0)
if [ -z "$ASB_TEAM_NAME" ]
then
echo "Please set ASB_TEAM_NAME before running this script"
else
if [ -f ${ASB_TEAM_NAME}.asb.env ]
then
if [ "$#" = 0 ] || [ $1 != "-y" ]
then
read -p "asb.env already exists. Do you want to remove? (y/n) " response
if ! [[ $response =~ [yY] ]]
then
echo "Please move or delete ${ASB_TEAM_NAME}.asb.env and rerun the script."
exit 1;
fi
fi
fi
echo '#!/bin/bash' > ${ASB_TEAM_NAME}.asb.env
echo '' >> ${ASB_TEAM_NAME}.asb.env
IFS=$'\n'
for var in $(env | grep -E 'ASB_' | sort | sed "s/=/='/g")
do
echo "export ${var}'" >> ${ASB_TEAM_NAME}.asb.env
done
cat ${ASB_TEAM_NAME}.asb.env
fi