Fixed indentation
This commit is contained in:
parent
567afc73a6
commit
0f4e699eca
|
@ -37,19 +37,18 @@ function hostname {
|
||||||
|
|
||||||
while [ "$HOST_OK" = false ]
|
while [ "$HOST_OK" = false ]
|
||||||
do
|
do
|
||||||
|
|
||||||
echo "Is ${HOST} correct?"
|
echo "Is ${HOST} correct?"
|
||||||
select yn in "Yes" "No";
|
select yn in "Yes" "No";
|
||||||
do
|
do
|
||||||
case $yn in
|
case $yn in
|
||||||
Yes )
|
Yes )
|
||||||
ok=true
|
ok=true
|
||||||
HOST_OK=true;
|
HOST_OK=true;
|
||||||
break;;
|
break;;
|
||||||
No )
|
No )
|
||||||
ok=false
|
ok=false
|
||||||
break;;
|
break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$ok" = false ]; then
|
if [ "$ok" = false ]; then
|
||||||
|
@ -60,29 +59,29 @@ function hostname {
|
||||||
}
|
}
|
||||||
|
|
||||||
function escape_slashes {
|
function escape_slashes {
|
||||||
sed 's/\//\\\//g'
|
sed 's/\//\\\//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_line {
|
function change_line {
|
||||||
local OLD_LINE_PATTERN=$1; shift
|
local OLD_LINE_PATTERN=$1; shift
|
||||||
local NEW_LINE=$1; shift
|
local NEW_LINE=$1; shift
|
||||||
local FILE=$1
|
local FILE=$1
|
||||||
|
|
||||||
local NEW=$(echo "${NEW_LINE}" | escape_slashes)
|
local NEW=$(echo "${NEW_LINE}" | escape_slashes)
|
||||||
sed -i '/'"${OLD_LINE_PATTERN}"'/s/.*/'"${NEW}"'/' "${FILE}"
|
sed -i '/'"${OLD_LINE_PATTERN}"'/s/.*/'"${NEW}"'/' "${FILE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":n:fh" opt; do
|
while getopts ":n:fh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
n) HOST=$OPTARG;;
|
n) HOST=$OPTARG;;
|
||||||
f) force=true;;
|
f) force=true;;
|
||||||
h) showhelp
|
h) showhelp
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
\?) echo -e "\nERROR:invalid option: -$OPTARG";
|
\?) echo -e "\nERROR:invalid option: -$OPTARG";
|
||||||
showhelp;
|
showhelp;
|
||||||
echo -e "\naborting.\n"
|
echo -e "\naborting.\n"
|
||||||
exit 1 >&2 ;;
|
exit 1 >&2 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $force ]; then
|
if [ $force ]; then
|
||||||
|
|
Loading…
Reference in New Issue