I understand! thank you. :-)~MIKE~(-: On Tue, Dec 23, 2014 at 1:45 AM, Kevin Fries wrote: > The brackets expand in place. It does not expand your command, but > instead the parameters. Let's say I wanted to create a list of > direcrories. I could do something like this > > $ mkdir -p a/{b,c/{d,e,f}} > > This expands to > > $ mkdir -p a/b a/c/d a/c/e a/c/f > > Sidenote... what if you wanted a directory named abc and second one abcde? > > $ mkdir -p abc{,de} > > The comma with nothing before it, gives you abc, and the de after the > comma gives you abcde > > Does this make more sense? apt-get is your command, and update and > upgrade are the parameter to the command. When you were using the curley > brackets, you were expanding a single command with two incompatible > parameters. > > Hope this makes sense. > > Kevin > On Dec 23, 2014 12:09 AM, "Michael Havens" wrote: > >> 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 >> 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" 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@birchwood-abbey.net> wrote: >>>> >>>>> > From: Michael Havens >>>>> > 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@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@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@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@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@lists.phxlinux.org > To subscribe, unsubscribe, or to change your mail settings: > http://lists.phxlinux.org/mailman/listinfo/plug-discuss >