commands
Matt Birkholz
matt at birchwood-abbey.net
Mon Dec 22 23:36:31 MST 2014
> From: Michael Havens <bmike1 at gmail.com>
> Date: Mon, 22 Dec 2014 15:46:23 -0700
>
> I was thinking, I could type in 'sudo apt-get update;sudo apt-get
> upgrade' but what would be a more efficient way?
>
> [...]
>
> sudo apt-get {update, upgrade}
> E: Invalid operation {update,
>
> This is interesting: when I typed in 'sudo {apt-get {update; upgrade}}' it
> didn't give me an error for '{update'
>
> So does anyone know what I'm talking about and how to do it?
Brace expansion is performed on a command. A semicolon separates
commands. Your command line
sudo {apt-get {update; upgrade}}
is interpreted as two commands:
sudo {apt-get {update
upgrade}}
So sudo complains about a strange command name "{apt-get", the
argument "{update" passes without comment, and the shell complains
about the command name "upgrade}}".
You cannot stick an unescaped semicolon inside braces.
Most efficient? Stick this in ~/.bashrc
alias do-it='sudo sh -c "apt-get update; apt-get upgrade"'
so you can say just
do-it
?
More information about the PLUG-discuss
mailing list