You are not logged in.

#1 2011-07-31 17:42:31

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Simple question about bash

If i am going to run a command via shell and it has lots of arguments (like when you do a massive installation of packages via pacman) it looks kind of messy.... just a single line with lots of package names.. kind of like this:

pacman -S package1 package2 package3 package4

I know there is a way to write the commands line by line, sort of like this:

pacman -S
package1
package2
package3
...

But i don't know (can't remember) how to do this..... a little help?

Offline

#2 2011-07-31 17:46:22

Atragor
Member
Registered: 2009-02-28
Posts: 59

Re: Simple question about bash

pacman -S \
  package1 \
  package2 \
  package3 \
  ...
  packageN

Offline

#3 2011-07-31 17:47:33

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Simple question about bash

Thanks! (total newbie question: 6 years using linux and i could not remember how to do this)

Offline

#4 2011-07-31 17:49:55

examon
Member
Registered: 2011-05-07
Posts: 208

Re: Simple question about bash

try

pacman -S \
package1 \
package2 \
package3 \
...

edit: nvm I was too slow smile

Last edited by examon (2011-07-31 17:50:20)

Offline

#5 2011-07-31 17:57:54

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Simple question about bash

As of pacman 3.5.1...

pacman -S - <<EOF
package1
package2
package3
package4
EOF

Offline

#6 2011-07-31 18:45:10

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Simple question about bash

Or

pacman -S $(cat somefile)

where somefile holds the package names w/o the version numbers, one per line.

Offline

Board footer

Powered by FluxBB