Quantcast
Channel: Reuse the `apt up` part of the `apt update` and `apt upgrade` commands to execute both in sequence in just one line - Ask Ubuntu
Browsing latest articles
Browse All 7 View Live

Answer by guntbert for Reuse the `apt up` part of the `apt update` and `apt...

@muru's answer led me to read up on history expansion and I found another variant $ sudo apt update $ ^dat^grad^ ^string1^string2^ is equivalent to !!:s/string1/string2/, which takes the last command...

View Article



Answer by Matthew Read for Reuse the `apt up` part of the `apt update` and...

Create a function like this: repeat() { for suffix in "${@:2}"; do eval "$1""$suffix"; done } Then you can run repeat 'apt up' {date,grade}. This has the benefit of being reusable for totally different...

View Article

Answer by jdgregson for Reuse the `apt up` part of the `apt update` and `apt...

I resuse the apt-get up part of the command using the following key sequence: Up ArrowBackspaceBackspaceBackspaceBackspace

View Article

Answer by muru for Reuse the `apt up` part of the `apt update` and `apt...

You can also use bash history expansion to get parts of the current command line and modify it: $ apt update; !#:s/date/grade apt update; apt upgrade; Reading package lists... Done ... !# is the...

View Article

Answer by Melebius for Reuse the `apt up` part of the `apt update` and `apt...

Another simple option using xargs instead of for: echo up{dat,grad}e | xargs -n1 apt Test: $ echo up{dat,grad}e | xargs -n1 echo apt apt update apt upgrade However, I’d prefer a shell alias just like...

View Article


Answer by Sergiy Kolodyazhnyy for Reuse the `apt up` part of the `apt update`...

The simple way ( and more efficient) is via for loop (on one line but here it's shown in multiple lines for clarity): for i in {date,grade}; do apt up${i} done The smart way is to make an alias in...

View Article

Reuse the `apt up` part of the `apt update` and `apt upgrade` commands to...

How to reuse the apt up part of the apt update and apt upgrade commands to execute both commands in sequence in just one line without an alias. Something like: apt up{date,grade}.

View Article
Browsing latest articles
Browse All 7 View Live




Latest Images