[bglug] [YASS] lv

k|b|s kbs@bglug.it
Sab 8 Gen 2005 18:00:41 CET


k|b|s al scrîf:
> Yet Another Shitty Script
Mi sono dimenticato "$1"...
Ciàpa la versione corretta.

--8<-- CUT HERE --8<-- 
#!/bin/bash 
# 
# lv (ls&vi)
# by k|b|s
# license: gpl

# Colors
black='\E[0;0;30m'
blue='\E[0;0;34m'
green='\E[0;0;32m'
cyan='\E[0;0;36m'
red='\E[0;0;31m'
purple='\E[0;0;35m'
brown='\E[0;0;33m'
lightgray='\E[0;0;37m'
darkgray='\E[0;1;30m'
lightblue='\E[0;1;34m'
lightgreen='\E[0;1;32m'
lightcyan='\E[0;1;36m'
lightred='\E[0;1;31m'
lightpurple='\E[0;1;35m'
yellow='\E[0;1;33m'
white='\E[0;1;37m'


Reset="tput sgr0"

cecho ()
{
  message=${1:-}
  color=${2:-}
  echo -e "$color""$message"
  $Reset
  return
}

necho ()
{
  message=${1:-}
  color=${2:-}
  echo -e -n "$color""$message"
  $Reset
  return
}


exit_usage=65
if [ -z "$1" ]; then
  echo ""
  cecho "Usage  : `basename $0` [file/dir]" $lightred
  cecho "  Example: `basename $0` /home/documents" $brown
  cecho "Options:" $lightred
  cecho "  press the higlighted key (NOT case sensitive) and" $brown
  cecho "  <ENTER> to open file with the associated program" $brown
  echo ""
  exit $exit_usage
fi
	      
echo ""
ls -lah --color "$1"
necho "Seems to be: " $purple ;
cecho "`file -b "$1"`" $brown ;
echo ""
cecho "Open file with:           Or just press <ENTER> to exit" $blue;
echo ""
cecho "(V)im (L)ynx (M)c fb(I) (B)iew mpg(1)23 (+)more (-)most" $green ;
cecho "(O)penOffice (F)irefox (N)autilus (G)pdf (Q)iv m(P)layer" $green ;
cecho "(E)xecute    (@)send as attachment    (A)nother program" $red ;
echo ""

read answer
case $answer in
	F|f)
	firefox "$1"
	;;
	V|v)
	vim "$1"
	;;
	L|l)
	lynx "$1"
	;;
	O|o)
	ooffice "$1"
	;;
	+)
	more "$1"
	;;
	M|m)
	mc "$1"
	;;
	1)
	mpg123 "$1"
	;;
	P|p)
	mplayer "$1"
	;;
	Q|q)
	qiv "$1"
	;;
	I|i)
	fbi "$1"
	;;
	B|b)
	biew "$1"
	;;
	G|g)
	gpdf "$1"
	;;
	-)
	most "$1"
	;;
	N|n)
	nautilus --no-desktop "$1" &
	;;
	E|e)
	"$1"
	;;
	@)
	mutt -a "$1"
	;;
	A|a)
	echo ""
	cecho "Which program? Type in and press <ENTER>" $lightred ;
	read answer
	$answer "$1"
	;;
	*)
	exit
	;;
esac
clear
--8<-- CUT HERE --8<-- 

-- 
             ::1 sweet ::1
k|b|s ~> mailto `echo ti.gulgb@sbk|'rev'`



Maggiori informazioni sulla lista bglug