Skip to main content
added 1 character in body
Source Link
Ed Morton
  • 36k
  • 6
  • 25
  • 60

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code` and Code). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing (had you done that your code would have reported this problem to you), and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code`). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing (had you done that your code would have reported this problem to you), and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing (had you done that your code would have reported this problem to you), and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

added 385 characters in body
Source Link
Ed Morton
  • 36k
  • 6
  • 25
  • 60

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code`). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing (had you done that your code would have reported this problem to you), and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code`). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing, and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code`). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing (had you done that your code would have reported this problem to you), and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

added 385 characters in body
Source Link
Ed Morton
  • 36k
  • 6
  • 25
  • 60

Not an answer butYou're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code`). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing, and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

Not an answer but you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

You're spawning a coprocess the first time you call tput for the color code 196 (for Red) and not closing the pipe to it so somethings getting hung up the next 2 times you try to use that same pipe to that same process (for Syp and Code`). As I've mentioned a couple of times now:

  1. don't use coprocesses for this as you don't need to,
  2. do test for getline failing, and
  3. do close the pipes you open as you go.

Also - you don't need to use 3 separate variables for this:

     ka = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214"
     kb = "Cyn 51 Mgn 201 Syp 196 Code 196"
     ks = sprintf("%s %s", ka, kb)

you could just do:

     ks = "Wht 15 Grn 34 Blu 39 Ylw 11 Red 196 Amb 214 " \
          "Cyn 51 Mgn 201 Syp 196 Code 196"

Also, this:

   kl { printf("%s%s%s\n", tseq[ctp], $0, rst) }
   !kl { printf("%s\n", $0) }

is just:

   kl { print tseq[ctp] $0 rst }
   !kl { print }

you're complicating your code unnecessarily with all those [s]printfs.

Source Link
Ed Morton
  • 36k
  • 6
  • 25
  • 60
Loading