Results 1 to 3 of 3

Thread: sudo command and &&

  1. #1
    Join Date
    Oct 2008
    Beans
    105
    Distro
    Ubuntu 9.10 Karmic Koala

    sudo command and &&

    I have a command of the form cmd1 && shutdown (options are implied), and shutdown requires sudo.

    Can I try "sudo cmd1 && shutdown" so that both commands will work, or does it have to be "cmd1 && sudo shutdown"? Also, is there a way to have sudo have me immediately enter my password after I press enter, so I can just leave the computer and let it take care of itself (cmd1 takes a while to finish)?

  2. #2
    Join Date
    Nov 2005
    Location
    Sendai, Japan
    Beans
    11,296
    Distro
    Kubuntu

    Re: sudo command and &&

    If running cmd1 as root is okay, you can get a root shell with

    Code:
    sudo -i
    and then just run

    Code:
    cmd1 && shutdown
    「明後日の夕方には帰ってるからね。」


  3. #3
    Join Date
    Oct 2008
    Beans
    105
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: sudo command and &&

    Ok, I think that did it! Thanks for your help!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •