Find the answer to your Linux question:
Results 1 to 4 of 4
I want to write a shell script (pack) to pack 3 files together. Like the winzip. And then to send it by email like attachments. Can anyone help me doing ...
  1. #1
    Just Joined!
    Join Date
    Mar 2007
    Posts
    4

    Pack several files

    I want to write a shell script (pack) to pack 3 files together. Like the winzip. And then to send it by email like attachments. Can anyone help me doing this shell script.
    I will use this command like
    pack document1 document1 document3 > example
    So the command "pack" it will pack the 3 files into the example folder.
    Please help me. I m stack.

  2. #2
    Linux Newbie birdman's Avatar
    Join Date
    Mar 2006
    Location
    Ireland
    Posts
    141
    Look at the man pages for tar. You want something like this:

    Code:
    tar -cvf packed.tar document1 document1 document3
    and to untar them

    Code:
    tar -xvf packed.tar
    If you read the man pages you can make sure you use it the way you want.

    Regards

  3. #3
    Just Joined!
    Join Date
    Mar 2007
    Posts
    4
    Yeah that' s right but i need to write a shell script for this command.

  4. #4
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    You might want to check out The Advanced Bash Scripting Guide. Basically shell scripts start with a shabang
    Code:
    #!/bin/bash
    To indicate the shell and that it is executable. After that it's just a shopping list of the commands you want to run. If you are having problems with any aspect of the script just ask

Posting Permissions

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