Why can't I update my system via shell script?

5,962

udpate and udgrade are wrong!

try this :

#!/bin/bash

echo "Updating system..."
sudo apt-get update
sudo apt-get upgrade
Share:
5,962

Related videos on Youtube

q9f
Author by

q9f

Updated on September 18, 2022

Comments

  • q9f
    q9f over 1 year

    I have a very simple script, let's call it update.sh:

    #!/bin/bash
    
    echo "Updating system..."
    sudo apt-get udpate
    sudo apt-get udgrade
    

    Running this script, throws the following error:

    me@host $ ./update.sh
    Updating system...
    E: Invalid operation udpate
    E: Invalid operation udgrade
    

    This is Ubuntu Server 14.04 LTS x64.

    me@host $ uname -a
    Linux host 3.13.0-30-generic #54-Ubuntu SMP Mon Jun 9 22:45:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    

    Running the command from shell directly works as desired:

    me@host $ sudo apt-get update
    Ign http://some.mirror.ubuntu.com trusty InRelease
    Ign http://some.mirror.ubuntu.com trusty-updates InRelease
    Hit http://some.mirror.ubuntu.com trusty Release.gpg
    Hit http://some.mirror.ubuntu.com trusty-updates Release.gpg
    Hit http://some.mirror.ubuntu.com trusty Release
    [...]
    

    Why is that? Any idea?

    • Pabi
      Pabi almost 10 years
      You have some typos.. its update and upgrade.
    • Pandya
      Pandya almost 10 years
      @vertoe command-line clearly showing error: E: Invalid operation udpate so check spelling right is update not udpate and same for upgrade!
    • citynorman
      citynorman over 6 years
      in my case it was a matter of saving with the right line endings. I was running vagrant in windows and saving a script file with windows settings so it wouldn't read correctly in the linux box.