PARTIAL_TEXT_PROBLEM with put shell("man " "ls") after cd fld 1

16 views
Skip to first unread message

Dan Kelleher

unread,
Sep 4, 2024, 10:57:12 PMSep 4
to SuperCard Discussion
using SC 4.83d3, Mojave, and a 2018 MacBook Pro Intel, when I use the shell function to put the man page for the unix cmd ls into a cd fld, SOME OF THE TEXT, in particular the headings of the various sections are INCORRECT - CHARACTERS ARE DUPLICATED.
But its not just the heading. Its not just upper case. For example look at the single line below the heading "SYNOPSIS" which contains errors in many kinds of characters BUT NOT ALL.
see the ATTACHED IMAGE which compares the accurate text in the terminal app and the aberrant text in cd fld 1


***someText Issue w put shell("man " "ls").png

MARK LUCAS

unread,
Sep 4, 2024, 11:49:15 PMSep 4
to via SuperCard Discussion
Hi Dan,

What you're seeing here is actually correct!

That's because man pages are pre-formatted to encode boldface for display in a terminal by backspacing and drawing characters a second time.

To avoid this 'character doubling' side-effect when capturing its output you just need to pipe it to col, which can strip out all the backspace sequences for you:

put shell("man ls | col -b") into cd fld 1

HTH,
-Mark

Dan Kelleher

unread,
Sep 5, 2024, 12:00:01 AMSep 5
to superca...@googlegroups.com
Thanks Mark. I didn’t know that!😂

On Sep 4, 2024, at 11:49 PM, 'MARK LUCAS' via SuperCard Discussion <superca...@googlegroups.com> wrote:

Hi Dan,
--
You received this message because you are subscribed to the Google Groups "SuperCard Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supercard-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/supercard-talk/1686A720-1103-4503-94D3-B627BB6141B0%40aol.com.

MARK LUCAS

unread,
Sep 5, 2024, 12:32:23 AMSep 5
to via SuperCard Discussion
BTW another handy col option frequently used in this context is the -x flag, which converts tabs to space runs.

That helps ensure proper indentation (at least in monospace fonts anyway).

So for example as a standalone utility:

function unMan inText
  return trim(unixTask(inText, "/usr/bin/col", "-bx"))
end unMan

HTH,
-Mark
Reply all
Reply to author
Forward
0 new messages