Results 1 to 7 of 7

Thread: Bash Script question....

  1. #1

    Bash Script question....

    How could I make a script that functioned like this:

    when you run the script like this "filename"

    the script would run

    tar xvfj "filename"

  2. #2

    Re:Bash Script question....

                     if [ -z "$1" ]; then
                         echo usage: $0 directory
                     OF=home-$(date +%Y%m%d).tgz
                     tar -cZf $TGTD$OF $SRCD
    this is straight out of the bash scripting howto. I didnt write this.

  3. #3

    Re:Bash Script question....

    Or you could just make it a regular script, run it like ./tarscript and use something liek this:

    echo "What file would you like to tar up?"
    read filename
    tar zxvf $filename
    echo "all done "

    But i was readin your post again and i wasnt sure if you wanted to tar something up or have it untar.... To untar you could set alais in your bash_profile tar = tar -zxvf

  4. #4

    Re:Bash Script question....

    Yeah it was to untar them, see I'm trying to make my own distro, at least a rough idea of it. So for a somewhat crude package managment system, i needed it. All my packages are just .tar.bz2 files, I have a way of uninstalling packages already, and I needed that for installing them. That is unitill I take the time later to figure out how to make a more elaborate system.

  5. #5

    Re:Bash Script question....

    OK I have another bash scripting questions,
    right now whenever you add a package it writes the package name into a text file, I need to know how to remove that packages name from teh database when you remove it.

  6. #6

    Re:Bash Script question....

    This is one way. Assuming the package we want to remove is contained in shell variable "$rmpkg" and the name of the package database file is "installed-pkgs":
    grep -v $rmpkg installed-pkgs >
    With a bit of refinement (eg check the new file is created ok, then move it back as "installed.pkgs&quot it would be workable.

  7. #7
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Milwaukee, WI

    Re:Bash Script question....

    Not that I am a guru in any of this, but a future modification may be to make a db instead of a text file for your software list. This could enable you to create a key to search for, which would speed your searches for a particular package considerably. Just a thought....

Similar Threads

  1. Help with bash script
    By woodson2 in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 12-30-2010, 07:19 PM
  2. SSH and bash script
    By vwgtiturbo in forum Programming
    Replies: 7
    Last Post: 12-25-2008, 05:40 AM
  3. Bash script problem
    By Schotty in forum Programming
    Replies: 1
    Last Post: 04-20-2007, 01:18 AM
  4. Bash script
    By linuxuser in forum Programming
    Replies: 1
    Last Post: 09-01-2005, 03:21 PM
  5. Help with bash script
    By tolstoy in forum Programming
    Replies: 5
    Last Post: 05-21-2002, 11:17 AM


Posting Permissions

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