Results 1 to 3 of 3

Thread: Combining commands

  1. #1
    Join Date
    Sep 2012
    Location
    12o4/14o4
    Beans
    Hidden!

    Combining commands

    I think first time ever I posted in programming; I be running with the big dogs

    Other than "&&" or ";;" is there a way to combine two move commands? Example:

    Code:
    sudo mv /var/lib/dpkg/status /var/lib/dpkg/status.broke
    sudo mv /var/lib/dpkg/status-old /var/lib/dpkg/status
    You can cat two files by:

    Code:
    cat filename1 filename2

  2. #2

    Re: Combining commands

    cat is a little different, since its actual job is to print as many files as you give it -- the name comes from "(con)catenate". mv's job is to move/rename one file, or to move a bunch of files into one directory.

    However, for the given application, you may be in luck. (Not sure how portable the -b option is, it might only work with GNU mv.)

    Code:
    $ mv --backup --suffix=.broke /var/lib/dpkg/status-old /var/lib/dpkg/status
    or to make that shorter
    $ mv -bS.broke /var/lib/dpkg/status{-old,}

  3. #3
    Join Date
    Sep 2012
    Location
    12o4/14o4
    Beans
    Hidden!

    Re: Combining commands

    Thank you Trent, that’s what I was looking for.

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
  •