Re: How to concatenate two (mor more) commands on one line?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Dom 31 Ene 2010 06:06,
Peter Hanke wrote:

Assume I want to execute 2 commands. The second command should only
processed if the first was finished successfully.

Furthermore the concatenation should take place on one line WITHOUT an
"If" condition.

I though something like the following should match the conditions

"command 1" && "command 2"

But this doesn't work. E.g. if commands contains some parameter which in
turn wrapped in double quotes e.g.

OK, no problem, you can use round parenthesis to do
that task.


"ls -l "/user/home/user/sub dir name" " && "....

Surely it does... try:

( ls -l "/user/home/user/sub dir name" ) \
&& ( ls -l "/user/home/user/another sub dir name" )


Also, you can do:

( ( ls -l "/user/home/user/sub dir name" ) \
&& ( ls -l "/user/home/user/another sub dir name" ) )


Just play a bit with those parenthesis... ;)


gives an error

How else can I achieve command concatenation?

Peter

Best regards,
- --
| Daniel Molina <dmw [at] coder [dot] cl> |
| IT Consulting & Software Development |
| Phone: +56 2 9790277 | http://coder.cl/ |
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCgAGBQJLZY9tAAoJEHxqfq6Y4O5Nm/4P/1SUIEF6U/dB+W/IZsRQyKxO
es/X4n9q672kBG4esNHnrEtS1jinoH4pYiuK7mN6CdvHMKkViNU+3znu4TrPVw9x
OKCFEaHAVLkQcto008Iqjp4URq32hAfds6SsMDW8+3CLWnjPNkXtd+SzF+a2zk4x
uddSj5EviND7GY8/C4f4rdGFXCdgJnWrZGoscV2BzQPBKC0634cQX3LZd5p093+g
7Dsgg5ztuf6a16N3zu4SXvJ6fuzK7XQDY6HgZdHFO21R6PJRzeb+dpVsQj0hW8ox
Jd03t/3c1pt8H/k2bX2KaEImpgHjWj9wth6MksfCdqbuAnijGQ/pYrVMxE2ooyWh
RWr/RikoIdRkMDJ38f+/osVj+TUk76dGMAsOmTEWhJcqm/CLUMEZVDP/Ct5t8rFD
gHfn3zljh3x0Qg1eloc2uvAFfQV6NW0cnx1N8ojmh+5/7sDCjLJk/ULvfKEs64QC
i84Ythk/QiX37TZjcoj6mj+C+FwPui5i57HkyowkDRg34AYj9/TNv50OHKLYZWgA
fKxlaxvplAwbvTOeUFNQAwpZ5i4oLOWMMTEw9hj3qHG48xyjAz2I4qb1hpxaCRhg
z2MOqWl40PjgTFPmLeGyWw/4PhUuYUw3TxYZt81RXqEkJufPjl3wkSGmg49/Fy3V
QnkhvijWOSBvdoC4AhDn
=mDcW
-----END PGP SIGNATURE-----

.