gcmd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gcmd-dev] Simple mimetype editor


From: Piotr Eljasiak
Subject: Re: [gcmd-dev] Simple mimetype editor
Date: Fri, 10 Aug 2007 01:10:16 +0200

> >> http://web.telia.com/~u97007522/linux/code/mimeedit/
> >>     
> >
> > I've added option (in Options|Programs tab) for MIME editor, where it's
> > possible to define a custom one. The editor is called with MIME type
> > passed as an argument, and the argument is appended at the end of the
> > string. 
> >   
> 
> Good idea!
> 
> Now i have got the script to report the same mimetype for a file
> as gnome do by using gnomevfs-info insted of the file command,
> also made some other changes. Added a changelog and placing
> the files in a tarball.
> 
> It is beginning to feel quite useful now..
> 

I'm sending you script snippet for handling options in shell scripts.
Please adapt it for your needs.


Piotr


function show_help {
    echo "Usage: $0 [--help] mime-type"
    echo "Usage: $0 [--help] file"
    echo
    echo "    --help              display this help."
    echo
    exit 0
}

if [ -z $1 ]
    then option="--help"
    else option=$1
fi

case $option in
  "-h" )
    show_help
    ;;
  "--help" )
    show_help
    ;;
  -* ) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
   { (exit 1); exit 1; }; }
    ;;
  * )
    # normal processing
    ;;
esac






reply via email to

[Prev in Thread] Current Thread [Next in Thread]