POSIX does not mandate that echo support the -n parameter.
printf has more well-defined behavior.
#!/bin/sh
-[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
+[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
fix_bootif() {
local macaddr=${1}
local IFS='-'
- macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
+ macaddr=$(printf '%s:' ${macaddr})
macaddr=${macaddr%:}
# strip hardware type field from pxelinux
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
[ -e $i ] || continue
channel=$(readlink -f $i)
- echo -n "${channel##*/},"
+ printf '%s' "${channel##*/},"
done
})
[ -n "$SUBCHANNELS" ] || return 1
lvmdevs=$(
for f in /tmp/.lvm_scan-*; do
[ -e "$f" ] || continue
- echo -n "${f##/tmp/.lvm_scan-} "
+ printf '%s' "${f##/tmp/.lvm_scan-} "
done
)
if [ ! -e /etc/lvm/lvm.conf ]; then
{
echo 'devices {';
- echo -n ' filter = [ '
+ printf ' filter = [ '
for dev in $lvmdevs; do
printf '"a|^/dev/%s$|", ' $dev;
done;
sleep 3
fipvlan "$netif" -c -s
else
- echo -n "$netif" > /sys/module/fcoe/parameters/create
+ printf '%s' "$netif" > /sys/module/fcoe/parameters/create
fi
need_shutdown
while [ $# -gt 0 ]; do
case $1 in
subvol\=*) :;;
- *) echo -n "${1}," ;;
+ *) printf '%s' "${1}," ;;
esac
shift
done
fi
done
if [ -n "$_found" ]; then
- [ $# -gt 0 ] && echo -n "$@"
+ [ $# -gt 0 ] && printf '%s' "$*"
return 0
fi
return 1;
done
if [ -n "$_gfound" ]; then
if [ $# -gt 0 ]; then
- echo -n "$@"
+ printf '%s' "$*"
else
- echo -n 1
+ printf 1
fi
debug_on
return 0
done
{
- echo -n "Mounted root filesystem "
+ printf "Mounted root filesystem "
while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
# randomly.
mdadm -W /dev/md0
set -e
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
#!/bin/sh
[ -b "/dev/mapper/$2" ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen "$1" "$2" </keyfile
# wait for the array to finish initailizing, otherwise this sometimes fails
# randomly.
mdadm -W /dev/md0
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
set -e
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile
,25M
EOF
udevadm settle
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/sda2 /keyfile
cryptsetup -q luksFormat /dev/sda3 /keyfile
cryptsetup -q luksFormat /dev/sda4 /keyfile
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile
stty sane
if strstr "$CMDLINE" "rd.shell"; then
- [ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
+ [ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
-echo -n test >keyfile
+printf test >keyfile
cryptsetup -q luksFormat /dev/sdb /keyfile
echo "The passphrase is test"
cryptsetup luksOpen /dev/sdb dracut_crypt_test </keyfile && \
#!/bin/sh
[ -b /dev/mapper/$2 ] && exit 0
-echo -n test >/keyfile
+printf test >/keyfile
/sbin/cryptsetup luksOpen $1 $2 </keyfile