summaryrefslogtreecommitdiff
path: root/setup-interfaces.in
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2022-11-05 18:25:04 +0100
committerJakub Jirutka <jakub@jirutka.cz>2022-11-05 21:31:46 +0000
commitd7ae66f869e50066dd7dd4297e175b744535cb32 (patch)
tree687d70bc8e0138e7d7195bc42787c2714edf4758 /setup-interfaces.in
parentf2a081f99a927faa9f7e21f7b25aa55af985fda0 (diff)
downloadalpine-conf-d7ae66f869e50066dd7dd4297e175b744535cb32.zip
replace 'echo -n' and 'echo -e' with printf
'echo -n' and 'echo -e' are not portable, not all commonly used shells support both of them (in the same way). 'echo -e' is not even defined in POSIX. https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html: > New applications are encouraged to use printf instead of echo. > ... > Conforming applications that wish to do prompting without <newline>s > or that could possibly be expecting to echo a -n, should use the > printf utility derived from the Ninth Edition system.
Diffstat (limited to 'setup-interfaces.in')
-rw-r--r--setup-interfaces.in16
1 files changed, 8 insertions, 8 deletions
diff --git a/setup-interfaces.in b/setup-interfaces.in
index 4a7078c..35cc8d6 100644
--- a/setup-interfaces.in
+++ b/setup-interfaces.in
@@ -496,14 +496,14 @@ prompt_for_interfaces() {
echo "iface $iface inet $type" >> interfaces
if [ -n "$bridge_ports" ]; then
PKGS="$PKGS bridge"
- echo -e "\tbridge-ports $bridge_ports" >> interfaces
+ printf "\tbridge-ports %s\n" "$bridge_ports" >> interfaces
fi
if [ -n "$bond_slaves" ]; then
PKGS="$PKGS bonding"
- echo -e "\tbond-slaves $bond_slaves" >> interfaces
+ printf "\tbond-slaves %s\n" "$bond_slaves" >> interfaces
fi
if [ -n "$raw_device" ]; then
- echo -e "\tvlan-raw-device $raw_device" >> interfaces
+ printf "\tvlan-raw-device %s\n" "$raw_device" >> interfaces
fi
case "$iface" in
*.[0-9]*|vlan[0-9]*)
@@ -514,14 +514,14 @@ prompt_for_interfaces() {
esac
case $type in
manual)
- echo -e "\tup ip link set \$IFACE up" >> interfaces
- echo -e "\tdown ip link set \$IFACE down" >> interfaces
+ printf "\tup ip link set \$IFACE up\n" >> interfaces
+ printf "\tdown ip link set \$IFACE down\n" >> interfaces
;;
static)
- echo -e "\taddress $address" >> interfaces
- echo -e "\tnetmask $netmask" >> interfaces
+ printf "\taddress %s\n" "$address" >> interfaces
+ printf "\tnetmask %s\n" "$netmask" >> interfaces
[ "$gateway" ] \
- && echo -e "\tgateway $gateway" >> interfaces
+ && printf "\tgateway %s\n" "$gateway" >> interfaces
;;
esac
echo "" >> interfaces