Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Problems with && concatenator. It stopped concatenating.

I ran:

sudo add-apt-repository ppa:igorgomes/ppa
sudo aptitude update

The aptitude update command began generating a screen output error (that I didn't remember to record) and since then the sequence sudo aptitude update && sudo aptitude upgrade stopped working. In concrete the first command executed but the second didn't.

I could fix it by removing the appropriate files on the folder "/etc/apt/sources.list.d" so the aptitude update command is working fine again, and so, the sudo aptitude update && sudo aptitude upgradecombination` is working againt too.

The problem has been solved but I'm really curious ¿why did it happen? It's not the first time the concatenator && stops working to me and I never found out what's the logic behind it. ¿Did it happen to anybody that could find out the reason?

Thank you in advance

pulchras

share|improve this question
1  
can you post the exact error message ? Sounds like a malformed line or perhaps no repo for your version of ubuntu. –  bodhi.zazen May 2 '13 at 18:39
    
may I ask why you decided to use aptitude as a frontend to APT rather than apt-get? apt-get is the default for Ubuntu. Also, sudo aptitude update; sudo aptitude upgrade would work regardless of whatever errors you are having with your sources. (that doesn't mean you shouldn't resolve the issue though. –  dward May 2 '13 at 18:41
    
undortunately I didn't record the error, and I'd prefer not to try messing againg with ppa because purging it sometimes is a headache. Even though I asked because it's not the first time that I do something that breaks the && (but never found out why) I use aptitude because I've read on so many sites that it has a better reputation resolving dependencies. I don't know if it's still the case, but till the moment it has worked fine for me :) –  pulchras May 2 '13 at 18:47
    
@pulchras the two work very similarly, and where they differ in practice, aptitude is probably the better of the two. apt-get seems to be much more popular so support might be better. does sudo aptitude update return an error? –  dward May 2 '13 at 19:14
    
@dward, a word of warning, aptitude has a long standing problem with multiarch - not recommended for current releases (except for only investigative purposes like aptitude search ...) –  guntbert May 2 '13 at 19:22
show 1 more comment

1 Answer 1

up vote 2 down vote accepted

I just got to the right answer when learning on a different matter, so I'll answer myself.

The && implies that the second command runs only if the first is executed successfully. If the first command throws an error (that means exit 1) the concatenator doesn't pass action to the next command in the sequence.

Keep in mind that it doesn't matter if you see the error on the screen output (foreground) or you can't see through screen output (background). When it's the second situacion, the error is being thrown against the shell interpreter even if you are not noticing it.

To check if a command gives an error back. Just execute that command alone, and after that, execute echo $? . If it returns 1, the command is failing and you have to find out what is going wrong on the command and fix it.

It is possible to execute sudo aptitude update; sudo aptitude upgrade to avoid having the mentioned problem, but for any curious guy out there, you will know what's happening.

If you want more information on what exit of a command means, you can check pages like: http://tldp.org/LDP/abs/html/exit-status.html

(there are tons of explanations on this, so no excuses for not googling if not satisfied)

Anyway, thank you guys! You gave quite valuable help :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.