Skip to main content
added 164 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k

In bash (which is still widely used despite all its limitations as it's the GNU shell so pre-installed on virtually all GNU/Linux systems as well as a few non-GNU systems), you can do it in two steps:

In bash, you can do it in two steps:

In bash (which is still widely used despite all its limitations as it's the GNU shell so pre-installed on virtually all GNU/Linux systems as well as a few non-GNU systems), you can do it in two steps:

added 48 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k

(- 1 because read starts filling up the array andat index 0, not 1; LC_ALL=C works around some bugssome bugs for text not encoded in the user's encoding in bash versions 5.0 to 5.2)

(- 1 because read starts filling up the array and index 0, not 1; LC_ALL=C works around some bugs for text not encoded in the user's encoding in bash versions 5.0 to 5.2)

(- 1 because read starts filling up the array at index 0, not 1; LC_ALL=C works around some bugs for text not encoded in the user's encoding in bash versions 5.0 to 5.2)

added 5 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
records=() readarray -O1 -td : records < <(printf %s: "$VAR") &&  printf '%s\n' "${records[2]}" 
records=() readarray -O1 -td : records < <(printf %s: "$VAR") printf '%s\n' "${records[2]}" 
records=() readarray -O1 -td : records < <(printf %s: "$VAR") &&  printf '%s\n' "${records[2]}" 
added 7 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
Loading
added 636 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
Loading
added 86 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
Loading
added 357 characters in body
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
Loading
Source Link
Stéphane Chazelas
  • 587.8k
  • 96
  • 1.1k
  • 1.7k
Loading