r/linux_programming • u/reflect_elegant • Oct 22 '20
Converting script to Posix compliant
Is there a way to make this section of a larger script Posix compliant?
options=$(lsblk | awk '/disk/ { print $1 }')
select opt in $options; do
if [ -n "$opt" ]; then
DEV_DISK_NAME="/dev/${opt}"
DEV_PART_NAME="/dev/${opt}"
break
else
printf 'This option is invalid.\n\n'
fi
done
3
Upvotes
View all comments
Show parent comment
1
u/reflect_elegant Oct 22 '20
Sorry for not being clear and/or using the wrong terminology. This runs in bash without issues, but in dash and similiar shells, it fails to execute. I assume this would be due to "bashisms", but I don't understand why this won't run in dash/mksh/ksh.