Find the answer to your Linux question:
Results 1 to 3 of 3
When i try to create a backup i am getting an error that says "tar: cowardly refusing to create an empty archive". If anyone can help i would be very ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2013
    Posts
    5

    Shell script backup problem.


    When i try to create a backup i am getting an error that says "tar: cowardly refusing to create an empty archive". If anyone can help i would be very appreciative.

    Code:
    #!/bin/bash
    
    clear #clears all other commands
      
       echo "-----------------------------------------"
       echo " **************Main Menu*****************"
       echo "-----------------------------------------"
       echo "Choose an option"
       echo "[A]Backup"
       echo "[B]Restore"
       echo "[C]Quit"
       echo
       echo "-----------------------------------------"
       echo
       read option
       case "$option" in
    
       "A" | "a" )  
       read -p "name your backup : " tarball
       read -p "Directory to back up: " bckdir
       echo
       tar -cf $tarball $backdir
       ;;
    
       "B" | "b" )
       read -p "Name of restore file: " tarball
       tar -xf $tarball
       ;;  
       
        "C" | "c" )
        
        echo "Exiting......"
        exit;;
      
    
    
    *) echo "Please press a letter between A to C" ;;
    
    esac

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,571
    Looks like a typo in a variable name. bckdir or backdir?
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  3. #3
    Just Joined!
    Join Date
    May 2013
    Posts
    5
    Thanks, that fixed the problem perfectly =)

Posting Permissions

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