commands

Michael Havens bmike1 at gmail.com
Tue Dec 23 00:08:27 MST 2014


thank you so much. the way I figure it 'apt-get' is the command I'm
expanding. But the command must be 'apt-get update, and 'apt-get upgrade'.

:-)~MIKE~(-:

On Tue, Dec 23, 2014 at 12:03 AM, Kevin Fries <kevin at fries-biro.com> wrote:

> Michael,
>
> As Matt said, braces expand into the same command, they are not used for
> multiple commands.  FOR is used for multiple commands.  While this is much
> more work in my opinion, this would also work... provided that there is no
> error.
>
> $ for cmd in update upgrade; do sudo apt-get ${cmd}; done
>
> This runs the two command in serial regardless of the results of either
> command.  My original answer did not run the second command if the first
> command failed.
>
> Kevin
> On Dec 22, 2014 11:55 PM, "Michael Havens" <bmike1 at gmail.com> wrote:
>
>> thank you Matt and Kevin. I was looking for a way to combine the two
>> commands with the curly brackets.
>>
>> :-)~MIKE~(-:
>>
>> On Mon, Dec 22, 2014 at 11:36 PM, Matt Birkholz <matt at birchwood-abbey.net
>> > wrote:
>>
>>> > 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
>>>
>>> ?
>>> ---------------------------------------------------
>>> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>
>>
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20141223/0c58bd5d/attachment.html>


More information about the PLUG-discuss mailing list