Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all Was wondering if any of you guys can help me. I unrar quite a few files and I like to see the time it takes. So a simple ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    5

    Very Simple Unrar script needed

    Hi all

    Was wondering if any of you guys can help me. I unrar quite a few files and I like to see the time it takes. So a simple cmd like:

    time unrar e file

    will unrar and give me time taken at the end. Im after a script that will add time unrar e by itself so all i have to type is one cmd with filename. Something like:

    urar file

    The script will do the time unrar e

    I tried this:

    #!/bin/bash
    time unrar e

    saved that as urar.py

    Saved it and made it chmod +x but when i did ./urar.py file

    But that didnt work

    Any help would be great.

    Many thanks

  2. #2
    Just Joined!
    Join Date
    Jun 2009
    Location
    Toronto
    Posts
    18
    Just add the argument to the command for a bash script:

    #!/bin/bash
    time unrar e $1
    I don't know why you're saving it as .py though... that isn't python code. just save it as 'unrar'

  3. #3
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845

    Post

    While cgrebeld's solution would work for your script you may want to look into alias'. An alias will let you create your own commands. So if you set an alias like this:

    Code:
    alias trar='time unrar e $1'
    Then you will be able to use the command:

    Code:
    trar filename
    In any directory you want, rather than having to run a script. When you end your session the alias will be lost so you may want to add the alias line to your .bashrc file
    Linux User #453176

  4. #4
    Just Joined!
    Join Date
    Jul 2009
    Posts
    5
    Both of you guys are fantastic. Thanks for all the help. This is just what I needed

    Cheers

Posting Permissions

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