این دو تا رو هم داشته باشین که بسیار کاربردی هستن
اولی اینکه تمام فایلهای فشرده رو باز می کنه و سختی کار رو برای کاربرای مبتدی از بین می بره
فایلهای فشرده ای رو که باز می کنه : zip, tar, tgz, tar.gz, tar.bz2, tar.z
requires: standard GNU commands
version: 1.2
usage: unpack2dir [-vhlr] <file> [file...]
options:
-r, remove the compressed file after extraction
-v, verbose
-h, usage and options (help)
-l, see this script"
#! /bin/sh
# ################################################## ###########################
NAME_="unpack2dir"
HTML_="uncompress unpack compressed files"
PURPOSE_="unpack zip, tar, tgz, tar.gz, tar.bz2, tar.z to a dir of the same name as archive prefix"
SYNOPSIS_="$NAME_ [-vhlr] <file> [file...]"
REQUIRES_="standard GNU commands"
VERSION_="1.2"
DATE_="1999-09-20; last update: 2006-02-03"
AUTHOR_="Dawid Michalczyk <dm@eonworks.com>"
URL_="www.comp.eonworks.com"
CATEGORY_="compress"
PLATFORM_="Linux"
SHELL_="bash"
DISTRIBUTE_="yes"
# ################################################## ###########################
# This program is distributed under the terms of the GNU General Public License
# HISTORY:
# 2006-02-03 v1.2 - added the -C flag to tar options. Otherwise tar would not
# extract to a dir with different name then the one found in the
# archive.
usage () {
echo >&2 "$NAME_ $VERSION_ - $PURPOSE_
Usage: $SYNOPSIS_
Requires: $REQUIRES_
Options:
-r, remove the compressed file after extraction
-v, verbose
-h, usage and options (help)
-l, see this script"
exit 1
}
# args check
[ $# -eq 0 ] && { echo >&2 missing argument, type $NAME_ -h for help; exit 1; }
# var init
rmf=
verbose=
# option and argument handling
while getopts vhlr options; do
case $options in
r) rmf=on ;;
v) verbose=on ;;
h) usage ;;
l) more $0; exit 1 ;;
\?) echo invalid argument, type $NAME_ -h for help; exit 1 ;;
esac
done
shift $(( $OPTIND - 1 ))
mkdirf() {
# usage: fnc <file_prefix> <file>
[ -d $1 ] && { echo "${NAME_}: skipping ${2} - dir ${1} already exist" ; continue; }
#echo $1
mkdir $1
# [[ $verbose ]] && echo "${NAME_}: unpacking "$2
}
file_getDirname() {
local _dir="${1%${1##*/}}"
[ "${_dir:=./}" != "/" ] && _dir="${_dir%?}"
echo "$_dir"
}
file_getBasename() {
local _name="${1##*/}"
echo "${_name%$2}"
}
clean() {
# usage <exit_status> <dir_to_rm>
[[ $1 != 0 ]] && rmdir $2 # remove empty dir if unpacking went wrong
[[ $1 == 0 && $verbose ]] && echo "${NAME_}: unpacking " ${dir}/${a}
[[ $rmf ]] && rm -f -- $a
}
start_dir=$(pwd)
for a in "$@"; do
cd $start_dir
fname=$(file_getBasename $a)
dir=$(file_getDirname $a)
cd $dir
a=$fname
case $a in
# zip
*.[zZ][iI][pP])
mkdirf ${a/.[zZ][iI][pP]/} $a
unzip -qq $a -d ${a/.[zZ][iI][pP]/}
clean $? ${a/.[zZ][iI][pP]/}
;;
# tar
*.[tT][aA][rR])
mkdirf ${a/.[tT][aA][rR]/} $a
tar -xf $a -C ${a/.[tT][aA][rR]/}/
clean $? ${a/.[tT][aA][rR]/}
;;
# tgz
*.[tT][gG][zZ])
mkdirf ${a/.[tT][gG][zZ]/} $a
tar -xzf $a -C ${a/.[tT][gG][zZ]/}
clean $? ${a/.[tT][gG][zZ]/}
;;
# tar.gz
*.[tT][aA][rR].[gG][zZ])
mkdirf ${a/.[tT][aA][rR].[gG][zZ]/} $a
tar -xzf $a -C ${a/.[tT][aA][rR].[gG][zZ]/}/
clean $? ${a/.[tT][aA][rR].[gG][zZ]/}
;;
# tar.bz2
*.[tT][aA][rR].[bB][zZ]2)
mkdirf ${a/.[tT][aA][rR].[bB][zZ]2/} $a
tar -xjf $a -C ${a/.[tT][aA][rR].[bB][zZ]2/}/
clean $? ${a/.[tT][aA][rR].[bB][zZ]2/}
;;
# tar.z
*.[tT][aA][rR].[zZ])
mkdirf ${a/.[tT][aA][rR].[zZ]/} $a
tar -xZf $a -C ${a/.[tT][aA][rR].[zZ]/}/
clean $? ${a/.[tT][aA][rR].[zZ]/}
;;
*) echo "${NAME_}: $a not a compressed file or lacks proper suffix" ;;
esac
done
این برنامه هم فایلهای Msword رو تو حالت متنی نمایش میده و برای زمانی که کاربرا از x-window استفاده نمی کنن (مخصوصا حرفه ای ها) بسیار پر کاربرد هستش و نشون میده که با چند تا دستور خاص میشه اونها رو به راحتی مطالعه کرد
purpose: display ms word doc file in ascii format
requires: standard GNU commands, catdoc
version: 1.0
usage: word2txt [-hl] <doc_file> [doc_file...]
options:
-h, usage and options (this help)
-l, see this script"
این هم کد اسکریپت :
#! /bin/sh
# ################################################## ###########################
NAME_="word2txt"
HTML_="convert word to text"
PURPOSE_="display ms word doc file in ascii format"
SYNOPSIS_="$NAME_ [-hl] <doc_file> [doc_file...]"
REQUIRES_="standard GNU commands, catdoc"
VERSION_="1.0"
DATE_="2004-07-22; last update: 2004-07-22"
AUTHOR_="Dawid Michalczyk <dm@eonworks.com>"
URL_="www.comp.eonworks.com"
CATEGORY_="text"
PLATFORM_="Linux"
SHELL_="bash"
DISTRIBUTE_="yes"
# ################################################## ###########################
# This program is distributed under the terms of the GNU General Public License
usage () {
echo >&2 "$NAME_ $VERSION_ - $PURPOSE_
Usage: $SYNOPSIS_
Requires: $REQUIRES_
Options:
-h, usage and options (this help)
-l, see this script"
exit 1
}
# missing args check
[ $# -eq 0 ] && { echo >&2 missing argument, type $NAME_ -h for help; exit 1; }
# arg handling and main script execution
case $1 in
-h) usage ;;
-l) more $0; exit 1 ;;
*) # main script execution
# check if required command is in $PATH variable
which catdoc &> /dev/null
[[ $? != 0 ]] && { echo >&2 the needed \"catdoc\" command is not in your PATH; exit 1; }
for a in $@;do
catdoc -b -s cp1252 -d 8859-1 -a $1
done ;;
esac
من خودم خیلی از این نوع اسکریپتها استفاده می کنم چون اجرا و کاربرد اونها بسیاری مواقع برام از محیط گرافیکی آسونتو و کاربردی تر هستش . موفق باشید