[PATCH] fff-gateway: some cosmetics
Robert Langhammer
rlanghammer at web.de
So Apr 26 21:42:05 CEST 2020
Hi,
es gäbe noch die ganz kurze Version. Dann allerdings nicht mehr so
leicht zu lesen:
- if ! ( [ "$response" == "y" ] || [ "$response" == "Y" ] ); then
- exit 1
- fi
+ case "$response" in [!Yy]) exit 1 ;; esac
echo
execute_subshell configure
Zur Abstimmung freigegeben :-)
Gruß Robert
Am 26.04.20 um 21:10 schrieb Robert Langhammer:
> The construct of if, ! and tests with some "||" are often hard to read. Let's use a simple and easy reading equivalent.
>
> Signed-off-by: Robert Langhammer <rlanghammer at web.de>
> ---
> .../fff-gateway/files/usr/sbin/configuregateway | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/packages/fff/fff-gateway/files/usr/sbin/configuregateway b/src/packages/fff/fff-gateway/files/usr/sbin/configuregateway
> index 3594a44..5230888 100755
> --- a/src/packages/fff/fff-gateway/files/usr/sbin/configuregateway
> +++ b/src/packages/fff/fff-gateway/files/usr/sbin/configuregateway
> @@ -40,14 +40,14 @@ execute_subshell() {
> configure() {
> echo "This script might remove existing vlans, interfaces, addresses, etc."
> read -r -p "Do you really want to continue? (y/n) " response
> - if ! ( [ "$response" == "y" ] || [ "$response" == "Y" ] ); then
> - exit 1
> - fi
> -
> - echo
> - execute_subshell configure
> -
> - exit 0
> + case "$response" in
> + [Yy])
> + echo
> + execute_subshell configure
> + exit 0 ;;
> + *)
> + exit 1 ;;
> + esac
> }
>
> reload_services() {
> --
> 2.20.1
>
Mehr Informationen über die Mailingliste franken-dev