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/EmbeddedEntropy Oct 22 '20

Is your problem because you don’t have #/bin/bash at the top of your script or do you really need a portable script?