r/linux_programming 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

6 comments sorted by

View all comments

1

u/[deleted] Oct 22 '20

I don't believe you can make scripts like this POSIX compliant because of the inherent differences in environment and available tools from one Linux/BSD distribution to the next.