File tree Expand file tree Collapse file tree 7 files changed +105
-0
lines changed
Expand file tree Collapse file tree 7 files changed +105
-0
lines changed Original file line number Diff line number Diff line change 1+ ex () {
2+ if [ -f $1 ] ; then
3+ type=$( file -0 $1 | cut -d " " -f2) ;
4+ case $type in
5+ bzip2) tar xjf $1 ;;
6+ gzip) tar xzf $1 ;;
7+ rar) unrar e $1 ;;
8+ zip) unzip $1 ;;
9+ 7z) 7z x $1 ;;
10+ * ) echo " '$1 ' cannot be extracted via extract()" ;;
11+ esac
12+ else
13+ echo " '$1 ' is not a valid file"
14+ fi
15+ }
Original file line number Diff line number Diff line change 1+ # netinfo - shows network information for your system
2+ netinfo ()
3+ {
4+ echo " --------------- Network Information ---------------"
5+ /sbin/ifconfig | awk /' inet addr/ {print $2}'
6+ /sbin/ifconfig | awk /' Bcast/ {print $3}'
7+ /sbin/ifconfig | awk /' inet addr/ {print $4}'
8+ /sbin/ifconfig | awk /' HWaddr/ {print $4,$5}'
9+ myip=` lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | sed ' /^$/d; s/^[ ]*//g; s/[ ]*$//g' `
10+ echo " ${myip} "
11+ echo " ---------------------------------------------------"
12+ }
Original file line number Diff line number Diff line change 1+ = bash functions =
2+
3+ Source these files to use them within bash scripts or on commandline:
4+
5+ # source additional commands
6+ for s in ${HOME}/.bashrc.d/*.sh ; do
7+ test -r $s && . $s
8+ done
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ echo " scale=2; $* " | bc -l
Original file line number Diff line number Diff line change 1+ = bash scripts =
2+
3+ Put these scripts into a folder known by your $PATH. Some may overlay existing executables.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # gtranslate.sh
3+ # Translate using Google Translate Ajax API:
4+ # http://ajax.googleapis.com/ajax/services/language/translate?v=1.0 \
5+ # &langpair=en|es&q=hello+world
6+ # More Info: http://code.google.com/apis/ajaxlanguage/documentation/
7+ # ksaver (at identi.ca), March 2010.
8+ # Licence: Public Domain Code.
9+
10+ progname=$( basename $0 )
11+
12+ if [ -z " $1 " ]
13+ then
14+ echo -e " Usage: $progname lang1 lang2 'string of words to translate...'"
15+ echo -e " Usage: $progname 'string of words to translate...' (de->en)"
16+ echo -e " Example: $progname en de 'Hello World!'\n"
17+ exit
18+ fi
19+
20+ if [ -z " $2 " ];
21+ then
22+ FROM=" de" ;
23+ TO=" en" ;
24+ else
25+ FROM=" $1 "
26+ TO=" $2 "
27+ fi
28+
29+ # Google Translate Ajax API Url
30+ TRANSURL=' http://ajax.googleapis.com/ajax/services/language/translate?v=1.0'
31+ LANGPAIR=" $FROM |$TO "
32+ shift 2
33+
34+ # Parse string to translate, change ' ' to '+'
35+ # STRING: String to translate.
36+ STRING=" $@ "
37+ PSTRING=$( echo " $STRING " | tr ' ' ' +' )
38+
39+ # Get translation
40+ RESPONSE=$( /usr/bin/env curl -s -A Mozilla \
41+ $TRANSURL ' &langpair=' $LANGPAIR ' &q=' $PSTRING )
42+
43+ echo -n " $progname > "
44+ # Parse and clean response, to show only translation.
45+ echo " $RESPONSE " | cut -d ' :' -f 3 | cut -d ' }' -f 1
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [ -n $1 ];
4+ then
5+ if [[ $1 == * :* ]];
6+ then
7+ file=$( echo $1 | cut -d " :" -f1) ;
8+ line=$( echo $1 | cut -d " :" -f2) ;
9+
10+ echo $file
11+ echo $line
12+ /usr/bin/vim +$line $file
13+ else
14+ /usr/bin/vim $* ;
15+ fi
16+ else
17+ /usr/bin/vim $* ;
18+ fi ;
19+
You can’t perform that action at this time.
0 commit comments