Announcement

Collapse
No announcement yet.

Little update script

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by jlittle View Post
    When the apt list output goes over a page, I get annoyed by it's lack of readability, and the stupid warning if I pipe the list through a paginator (that is, less). I don't have a good solution.
    I've given up on apt list --upgradable, and now prefer an aptitude command that gives more useful output, for example, today:
    Code:
    $ aptitude -F '%12p %t %V %d'  search '~U' 
    libnss3                  focal-security         2:3.49.1-1ubun Network Security Service libraries
    libopenexr24             focal-security         2.3.0-6ubuntu0 runtime files for the OpenEXR image library
    linux-base               focal-security,focal-u 4.5ubuntu3.1   Linux image base package
    snapd                    focal-updates          2.45.1+20.04   Daemon and tooling that enable snap packages
    aptitude makes a pretty good stab at adjusting the column widths to suit the width of the terminal window, but it's not ideal, so I mucked around with cut, paste, and column -t:
    Code:
    #!/bin/bash
    work=$(mktemp --tmpdir ai2XXXX)
    trap "rm $work" EXIT
    
    if aptitude -F '%12p %t %V %d'  search '~U' > $work
    then
     unset LESS
     paste -d ' ' <(cut -d ' ' -f -4 < $work  | column -t) \
                  <(cut -d ' ' -f 5- < $work) | less -eX
    fi
    for example, today:
    Code:
    libnss3       focal-security                2:3.49.1-1ubuntu1.2  Network Security Service libraries
    libopenexr24  focal-security                2.3.0-6ubuntu0.2     runtime files for the OpenEXR image library
    linux-base    focal-security,focal-updates  4.5ubuntu3.1         Linux image base package
    snapd         focal-updates                 2.45.1+20.04         Daemon and tooling that enable snap packages
    less is cool here because it will redisplay the output if you widen the window, so if the output gets wrapped too much because some column is extra wide, like the linux-base line in my example, I can resize the window to make it readable.
    Regards, John Little

    Comment


      #17
      Interesting

      Comment


        #18
        Interesting indeed!
        Appending that command to "sudp apt update & " and making it an alias would be the perfect update listing command.

        EDIT:
        I started experimenting with making the alias for jlittle's aptitude command, which appears to be above my 79 yr old pay grade, but inadvertently opened the cli menu for aptitude, which I never knew existed. Neat little menu!
        Click image for larger version

Name:	aptitude_cli_menu.jpg
Views:	1
Size:	54.3 KB
ID:	644821
        Last edited by GreyGeek; Jul 07, 2020, 01:04 PM.
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #19
          Originally posted by Don B. CillyB
          and for anyone who might be vaguely interested in a kdialog+xterm script,
          and to relieve the boredom of a rainy confined day...
          You might try to use zenity instead of kdialog to make it usable on more distros
          Also to prevent the script generating a needless call-stack, you should not re-execute your script inside itself...
          Just use a while/do or untill/do loop...

          Originally posted by > man bash
          while list-1; do list-2; done
          until list-1; do list-2; done

          The while command continuously executes the list list-2 as long as the last command in the list list-1 returns an exit status of zero. The until command is identical to the while command, except that the test is negated: list-2 is executed as long as the last command in list-1 returns a non-zero exit status. The exit status of the while and until commands is the exit status of the last command executed in list-2, or zero if none was executed.
          Happy coding
          Last edited by ©TriMoon™; Jul 29, 2020, 04:23 AM.
          Well thats all for now, 3M

          Comment

          Working...
          X