Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • @StéphaneChazelas I have edited the shell script to fix the issues that arise when the positional parameters is set '*' or set a '' b. Please take a look. Thank you. Commented Dec 1, 2023 at 2:46
  • Note that setting IFS to newline for read doesn't make much sense since read only reads one line at a time, so there will never be any newline in it to split on. To read a line, the idiomatic syntax is IFS= read -r line. See Understanding "IFS= read -r line" Commented Dec 1, 2023 at 10:17
  • If you set LC_ALL=C for sed, then you need to set it for awk as well, but then it will affect the string collation order. In the C locale, every byte is treated as a character. While in the user's locale in text utilities such as sed or awk (not printf), byte sequences are meant to be decoded into characters. In some locales, there are some characters whose encoding contains the encoding of backslash. Commented Dec 1, 2023 at 11:03
  • @StéphaneChazelas Fixed the IFS issue. Thank you for the explanation. Commented Dec 2, 2023 at 22:08
  • @StéphaneChazelas Regarding the LC_ALL=C for sed: is it a good idea to remove LC_ALL=C and leave the choice of LC_ALL to the programmer/user? Commented Dec 2, 2023 at 22:12